Closed
Bug 623291
Opened 14 years ago
Closed 14 years ago
Firefox 4: change/blur event are not dispatched to input upon button click
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
People
(Reporter: avernet, Assigned: smaug)
References
()
Details
(Whiteboard: [softblocker])
Attachments
(2 files, 1 obsolete file)
474 bytes,
text/html
|
Details | |
3.33 KB,
patch
|
enndeakin
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7) Gecko/20100101 Firefox/4.0b7
Build Identifier: 4b8
-
Reproducible: Always
Steps to Reproduce:
1. Click on the input field, and enter some text
2. Click on the "nothing" button
Actual Results:
On Firefox 4b8, the change and blur events are not dispatched.
(When the change/blur listener are called, alerts are shown.)
It is called on Firefox 3.6, Safari 5, and just any other browser.
Expected Results:
The change/blur events should be dispatched.
Note this is related by not different than Bug 577316.
The issue here is not that the button doesn't get the focus,
but that the change event is not dispatched to input field.
Also related, at the UX level, on Safari 5 the input looses the
focus when clicking on the button, even if the button doesn't
acquire the focus. This is not the case on Firefox 4b8.
Assignee | ||
Comment 1•14 years ago
|
||
A testcase would be great.
We need to fix this for FF4.
blocking2.0: --- → ?
Assignee | ||
Comment 2•14 years ago
|
||
I wonder if we end up switching accessibility.mouse_focuses_formcontrol
on OSX for FF4 to get the old behavior.
Assignee | ||
Comment 3•14 years ago
|
||
(In reply to comment #1)
> A testcase would be great.
A *minimal* testcase, attached using "Add an attachment"
Comment 4•14 years ago
|
||
Could you be more specific? The link you specified doesn't demonstrate any bug.
Not firing the change or blur events when clicking the button is correct behaviour, as the focus does not change when clicking buttons on Mac.
Reporter | ||
Comment 5•14 years ago
|
||
(In reply to comment #1)
> A testcase would be great.
To just run the example (not see the source in jsFiddle), you can use: http://fiddle.jshell.net/avernet/Zm7Fx/show/light/
blocking2.0: ? → ---
Reporter | ||
Comment 6•14 years ago
|
||
(In reply to comment #4)
> Could you be more specific? The link you specified doesn't demonstrate any bug.
>
> Not firing the change or blur events when clicking the button is correct
> behaviour, as the focus does not change when clicking buttons on Mac.
Try the same example on Safari 5. You'll notice that the button doesn't get the focus, but that the input looses the focus, and that the blur/change events are dispatched to the input (as they are in any other browser).
Comment 7•14 years ago
|
||
OK, so what you're actually asking for is for the focus to be removed from existing elements when buttons are clicked.
Reporter | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> OK, so what you're actually asking for is for the focus to be removed from
> existing elements when buttons are clicked.
That's right, and consequently for the blur/change events to be dispatched accordingly.
(This would be consistent with the event behavior in Safari, which seems to be the direction Firefox is going to on OS X, at least as far as the default behavior is concerned.)
(This would also be "more compatible" with what happens in Firefox 3.6 and other browsers. Imagine that you have JavaScript that validates form fields on "change": with 4b8 that validation code won't run if users change a field and click on a button, while it was running in 3.6, and is running with Safari 5 and other browsers.)
Comment 9•14 years ago
|
||
OK this is because at http://mxr.mozilla.org/mozilla/source/content/html/content/src/nsHTMLButtonElement.cpp#417 , the event prevents default handling.
This has always been the case for <button>, but, oddly, not for <input type="button">. A similar test using <input type="button"> works as expected here.
Olli, do you think it makes sense to just remove the event canceling line linked to above?
Assignee | ||
Comment 10•14 years ago
|
||
Assignee | ||
Comment 11•14 years ago
|
||
Need to test still <a><button>foo</button></a>
Assignee | ||
Comment 12•14 years ago
|
||
Copying from IRC:
I think http://mxr.mozilla.org/mozilla/source/content/html/content/src/nsHTMLButtonElement.cpp#417 could be replaced with
aVisitor.mEvent->flags |= NS_EVENT_FLAG_PREVENT_ANCHOR_ACTIONS
![]() |
||
Comment 13•14 years ago
|
||
Sounds related to bug 618414, for what it's worth. <a> and <button> both have the weird hackery there, but <input type="button"> does not.
Status: UNCONFIRMED → NEW
blocking2.0: --- → ?
Ever confirmed: true
Reporter | ||
Updated•14 years ago
|
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → Olli.Pettay
Assignee | ||
Comment 14•14 years ago
|
||
I'll upload a minimal testcase.
Assignee | ||
Comment 15•14 years ago
|
||
Uploaded to tryserver
Assignee | ||
Comment 16•14 years ago
|
||
I guess we should do this for FF4.
Attachment #502448 -
Attachment is obsolete: true
Attachment #502814 -
Flags: review?(enndeakin)
Comment 17•14 years ago
|
||
Comment on attachment 502814 [details] [diff] [review]
patch
OK, but you should be able to put all the code in runTests without the need to use separate 'next' and 'done' methods.
Attachment #502814 -
Flags: review?(enndeakin) → review+
Assignee | ||
Comment 18•14 years ago
|
||
Well, next() and done() helped with debugging, and I don't see reason not
to use them.
Assignee | ||
Updated•14 years ago
|
Attachment #502814 -
Flags: approval2.0?
Updated•14 years ago
|
blocking2.0: ? → final+
Whiteboard: [softblocker]
Updated•14 years ago
|
Attachment #502814 -
Flags: approval2.0?
Assignee | ||
Comment 19•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 20•14 years ago
|
||
Olli, awesome, thank you!
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•