Closed Bug 16924 Opened 25 years ago Closed 25 years ago

Cannot set the focus on a non-visible input element into a scrollable tree

Categories

(Core :: XUL, defect, P2)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

Attachments

(1 file)

It's another variation of the focus bug 15002. But this case is different. The problem occurs with message compose
addressing widget. But for simplify the problem, I will describe it with a sample xul file attached to this bug
report:

I have a tree with 4 rows defined, each of them has an input field. The defined tree height allow only 3 rows to be
visible. Each
time I press return into one of the input element, the next input field will get the focus. That works fine until the
next row isn't
visible, in this case input.focus() failed with the error -2147467262 (component does not have requested interface).

How to reproduce it:
------------------
1) Install attached files addressWidget.xul and addressWidget.js into your HD at the same location
2) open addressWidget.xul into the browser (Mozilla)
3) type something into the first input field and then press <return>
 --> second input field get the focus
4) type something into the second input field and then press <return>
 --> third input field get the focus
5) type something into the third input field and then press <return>
 --> JS exception throw, the third input field keep the focus!

Expected result: the tree should scroll up one row and give the focus to the fourth input field which is now visible
oops, don't need addressWidget.js, the .xul is enough...
Assignee: ducarroz → trudelle
Blocks: 16841
Assignee: trudelle → saari
Priority: P3 → P2
Target Milestone: M11
Have you tried this using a table instead? Would that be a viable workaround?
reassigning to saari as p2 for m11.  should this be a dogfood candidate?
I will try to convert the addressingWidget to use table. The main reason we use tree instead table is that we will

need to be able to specify the height of the tree in term of rows. As this feature isn't implemented yet, table should

be fine...
mass-moving most m11 bugs to m12
We cannot use table as you cannot control the height of a table. All rows are
visible.
I think this is due to the tree widget's lazy building of rows... you're trying
to focus a row that isn't built yet. Hyatt, does that sound right?
do we have a work around (else than using JS timer do delay the focus call)?
Oh God.

This sucks.

This really sucks.

Do you REALLY have to use a tree widget?  You're pushing it in ways that I just
can't deal with.
You could use a table instead of a tree and constrain its height either by
making a tbody with an overflow auto and a height constraint or by making a
constrained iframe and just throwing content into that.
Mass-moving non-PDT+ bugs to M13
Assignee: saari → hyatt
David, I'm tossing you this bug. I guess maybe alec should get it now?
Status: NEW → ASSIGNED
Target Milestone: M13 → M15
Ok, I believe alec has given you the capability to scroll to a certain row.  You 
can scroll first, and then call focus.  Tossing back to you.

This is true, right alec?
Assignee: hyatt → ducarroz
Status: ASSIGNED → NEW
Change it for M14. Forcing the row to scroll before setting its value may fix several bugs.
Status: NEW → ASSIGNED
Target Milestone: M15 → M14
yep, you can call tree.ensureContentIsVisible() (you can use any element in the
tree, and it will bring that element's row into view) and then focus it....
though I don't know exactly how this works with reflows, etc...
ensureContentIsVisible will not actually take effect until the next reflow,
which means it might not happen until after the your JS has finished
executing... 

I think hyatt can answer this one with my explanation. Hyatt, basically it
behaves just like the user dragged the thumb the exact minimum amount in order
to bring that row into view, so it does that whole smart-scrolling thing where
it destroys only the minimum number of frames to get there, and leaves a content
chain for the next reflow.
btw, Jean-Francois - this is something you need to call (assuming it works of
course) from the compose window, not something the tree can do. stop by if you
need a better explanation
I have a fix. That also fix bug 21280
Whiteboard: Fixed reviewed, waiting for tree to open
Fixed and checked in
Whiteboard: Fixed reviewed, waiting for tree to open
oops, change resolution to fixed
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
ducarroz, does your attached testcase work for you? For me, with the 2000013111 build on WinNT I can't even get focus to the 
first textfield much less type into it or any of the others. AM I being blocked by another new bug or is the testcase not valid?
The testcase doesn't work and nothing I've seen from the addressing widget in mail compose makes me think this is fixed. I 
suspect another/other bugs may be blocking me but without any more information I am forced to REOPEN this bug.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I don't know if my test case works but the way to test it is to enter 4 
recipients by using only the enter key, the cursor should be alway into the new 
field after pressing enter.

But because of bug 26344, you cannot verify this yet.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Depends on: 26344
Resolution: --- → FIXED
VERIFIED fixed with 2000020708 WinNT build
Status: RESOLVED → VERIFIED
No longer blocks: 16841
Summary: Cannot set the focus on an no-visible input element into a scrollable tree → Cannot set the focus on a non-visible input element into a scrollable tree
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: