The default bug view has changed. See this FAQ.

document.activeElement should never return native anonymous content

RESOLVED FIXED

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
7 years ago
5 years ago

People

(Reporter: smaug, Assigned: smaug)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

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

5 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: nobody → bugs
Created attachment 620830 [details] [diff] [review]
patch
Attachment #620830 - Flags: review?
Comment on attachment 620830 [details] [diff] [review]
patch

https://tbpl.mozilla.org/?tree=Try&rev=52113d2992a5
Attachment #620830 - Flags: review? → review?(enndeakin)

Updated

5 years ago
Attachment #620830 - Flags: review?(enndeakin) → review+
Bah, the patch revealed another bug.
Created attachment 621005 [details] [diff] [review]
+fix to test_bug430351.html

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">

Updated

5 years ago
Attachment #621005 - Flags: review?(enndeakin) → review+
https://hg.mozilla.org/mozilla-central/rev/032d43b1770f
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.