Closed Bug 561664 Opened 11 years ago Closed 9 years ago

document.activeElement should never return native anonymous content

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 file, 1 obsolete file)

Currently document.activeElement may return the input element inside type="file". 
Content JS gets then an exception when it tries to access the element.
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: nobody → bugs
Attached patch patch (obsolete) — Splinter Review
Attachment #620830 - Flags: review?
Attachment #620830 - Flags: review?(enndeakin) → review+
Bah, the patch revealed another bug.
https://tbpl.mozilla.org/?tree=Try&rev=527d379c12aa
Attachment #620830 - Attachment is obsolete: true
Attachment #621005 - Flags: review?(enndeakin)
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+
https://hg.mozilla.org/mozilla-central/rev/032d43b1770f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.