document.activeElement should never return native anonymous content

RESOLVED FIXED

Status

()

RESOLVED FIXED
9 years ago
7 years ago

People

(Reporter: smaug, Assigned: smaug)

Tracking

Trunk
x86
macOS
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

9 years ago
Currently document.activeElement may return the input element inside type="file". 
Content JS gets then an exception when it tries to access the element.

Comment 2

7 years ago
This is causing problems for us in jQuery UI. We wrap elements for certain animations, and the wrapping causes elements to lose focus, so we reset focus after wrapping. However, if a file input has focus, then we try setting the focus on the exposed text input, which is no longer in the document (not sure why).

jQuery UI bug: http://bugs.jqueryui.com/ticket/8288
Reduced test case using jQuery UI: http://jsfiddle.net/2efq2/8/
Reduced test case using plain JavaScript/DOM: http://dev-test.nemikor.com/bugs/firefox/input-type-file-activeelement.html
(Assignee)

Updated

7 years ago
Assignee: nobody → bugs
(Assignee)

Comment 3

7 years ago
Posted patch patch (obsolete) — Splinter Review
Attachment #620830 - Flags: review?
Attachment #620830 - Flags: review?(enndeakin) → review+
(Assignee)

Comment 5

7 years ago
Bah, the patch revealed another bug.
(Assignee)

Comment 6

7 years ago
https://tbpl.mozilla.org/?tree=Try&rev=527d379c12aa
Attachment #620830 - Attachment is obsolete: true
Attachment #621005 - Flags: review?(enndeakin)
(Assignee)

Comment 7

7 years ago
Neil, the patch doesn't change the focusing behavior, but it is just that
test_bug430351.html tests currently  the_native_anon_button_inside_file_input != <input type="file">
With the patch that becomes <input type="file"> != <input type="file">
Attachment #621005 - Flags: review?(enndeakin) → review+
(Assignee)

Comment 8

7 years ago
https://hg.mozilla.org/mozilla-central/rev/032d43b1770f
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.