Closed Bug 834652 Opened 11 years ago Closed 3 years ago

Fix <input type='file'> focus handling

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

RESOLVED DUPLICATE of bug 505355

People

(Reporter: mounir, Unassigned)

References

Details

<input type='file'> has a very weird behaviour regarding focus because the frame has two anonymous nodes and we have to focus the second one. Because of that, the focus/blur handling sometimes doesn't work as expected.

For example, right now, if .focus() is called on the element, we will get the frames and focus the anonymous node that needs to be focused. If the layout isn't there yet, the element wouldn't be focused. We can easily fix that by creating the frames when .focus() is called (aka. doing a reflow) but that would only be a new hack on top of others. I actually have a patch doing that somewhere in my queue but I wasn't very happy with pushing it.

I feel like a better design would be to have the element marking itself as focused without having to care about the layout. Then, when the layout is created, it could ask the element its current focus state and focus the appropriate anonymous node. I tried an implementation of that but I had a few issues regarding events going back and forth inside the anonymous tree. I didn't spent much time on that though.

It would be interesting to fix that because some other elements might suffer from the same issues. I think of <input type='number'> or even date/time inputs.
you may want to read nsFocusManager::CheckIfFocusable
We don't want type="file" to behave differently.
CheckIfFocusable does flush and check for primary frame.
No longer blocks: 834206
Blocks: 701353
Depends on: 757664
No longer depends on: 757664
Depends on: 533748
Re-adding bug 834206 because I'm not sure why it has been removed from the list.
Blocks: 834206
... it has been marked as duplicate, that's a good reason :)
No longer blocks: 834206
No longer blocks: 701353

Bulk-downgrade of unassigned, 4 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.