WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
93674
change event is sent to <input type=radio> before click event
https://bugs.webkit.org/show_bug.cgi?id=93674
Summary
change event is sent to <input type=radio> before click event
Glenn Maynard
Reported
2012-08-09 18:39:35 PDT
When a radio button (or checkbox) is clicked, the onchange event is sent before onclick instead of after. If onclick is defaultPrevented, the page has now received onchange in the temporary checked state, even though the "canceled activation steps" reset the checked state to false. Opera and Firefox behave per spec: onclick is sent before onchange, and if onclick is stopped, the onchange event is never fired. (Firing onclick is the activation behavior of the element, which happens after an uncancelled click.) IE9 matches what WebKit is doing.
Attachments
Patch
(4.99 KB, patch)
2015-05-26 02:04 PDT
,
Rohit
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews101 for mac-mavericks
(573.12 KB, application/zip)
2015-05-26 02:56 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews106 for mac-mavericks-wk2
(591.83 KB, application/zip)
2015-05-26 03:02 PDT
,
Build Bot
no flags
Details
Patch
(10.13 KB, patch)
2015-05-26 03:37 PDT
,
Rohit
no flags
Details
Formatted Diff
Diff
Patch
(10.11 KB, patch)
2015-05-26 23:42 PDT
,
Rohit
no flags
Details
Formatted Diff
Diff
Patch
(10.38 KB, patch)
2015-06-12 04:36 PDT
,
Rohit
tkent
: review-
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-08-10 11:19:47 PDT
Weird! But if IE and WebKit are doing the same thing, then nearly every browser works like that.
Glenn Maynard
Comment 2
2012-08-10 11:20:45 PDT
Opera and Firefox don't.
Alexey Proskuryakov
Comment 3
2012-08-10 13:05:19 PDT
Got that, I was counting not by browser name, but by installed base. That's just a data point - Firefox behavior seems much more logical, unless there is an explanation for IE behavior that I don't know.
Glenn Maynard
Comment 4
2012-08-10 14:44:47 PDT
At least, since cancelling onchange doesn't do anything, people aren't expecting preventDefault on onchange to prevent onclick. I wonder if Mozilla has received any bug reports for following the spec.
Alexey Proskuryakov
Comment 5
2012-08-13 09:57:16 PDT
See also:
bug 93760
.
Rohit
Comment 6
2015-05-26 02:04:44 PDT
Created
attachment 253697
[details]
Patch
WebKit Commit Bot
Comment 7
2015-05-26 02:05:52 PDT
Attachment 253697
[details]
did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 8
2015-05-26 02:56:01 PDT
Comment on
attachment 253697
[details]
Patch
Attachment 253697
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.appspot.com/results/6352494187773952
New failing tests: fast/forms/radio/radio-group-keyboard-change-event.html
Build Bot
Comment 9
2015-05-26 02:56:04 PDT
Created
attachment 253700
[details]
Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 10
2015-05-26 03:02:12 PDT
Comment on
attachment 253697
[details]
Patch
Attachment 253697
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.appspot.com/results/6332516818485248
New failing tests: fast/forms/radio/radio-group-keyboard-change-event.html
Build Bot
Comment 11
2015-05-26 03:02:16 PDT
Created
attachment 253701
[details]
Archive of layout-test-results from ews106 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Rohit
Comment 12
2015-05-26 03:37:43 PDT
Created
attachment 253702
[details]
Patch
Ryosuke Niwa
Comment 13
2015-05-26 13:36:26 PDT
Comment on
attachment 253702
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=253702&action=review
> Source/WebCore/html/CheckboxInputType.cpp:86 > + } else { > + element().dispatchChangeEventIfNeeded(); > }
nit: No curly braces arouns a single line statement.
> Source/WebCore/html/HTMLInputElement.cpp:862 > + setTextAsOfLastFormControlChangeEvent(String());
Why is this call to setTextAsOfLastFormControlChangeEvent necessary even we've already called it in HTMLInputElement::setChecked? It seems strange that we need to call it in both places.
> Source/WebCore/html/RadioInputType.cpp:184 > + } else { > + element().dispatchChangeEventIfNeeded(); > }
nit: No curly braces around a single line statement.
Rohit
Comment 14
2015-05-26 23:42:31 PDT
Created
attachment 253780
[details]
Patch
Rohit
Comment 15
2015-05-26 23:48:28 PDT
Comment on
attachment 253702
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=253702&action=review
>> Source/WebCore/html/CheckboxInputType.cpp:86 >> } > > nit: No curly braces arouns a single line statement.
Done.
>> Source/WebCore/html/HTMLInputElement.cpp:862 >> + setTextAsOfLastFormControlChangeEvent(String()); > > Why is this call to setTextAsOfLastFormControlChangeEvent necessary even we've already called it in HTMLInputElement::setChecked? > It seems strange that we need to call it in both places.
Removed. I added setTextAsOfLastFormControlChangeEvent(String()) in both as setChecked() and dispatchChangeEventIfNeeded() are getting called in if-else statements. But as setChecked() is already getting called in willDispatchClick for both radio and checkbox, it makes more sense to remove it from dispatchChangeEventIfNeeded().
>> Source/WebCore/html/RadioInputType.cpp:184 >> } > > nit: No curly braces around a single line statement.
Done.
Antonio Gomes
Comment 16
2015-06-10 09:32:17 PDT
Comment on
attachment 253780
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=253780&action=review
code looks reasonable, but you need to add some background/context to your commit message.
> Source/WebCore/ChangeLog:5 > +
please - add the motivation of the spec (match the spec, add an url) - any possible real world web site behavior that the patch fixes - also mention that webkit now matches firefox and open (presto or chromium?) behavior?, and does not match IE anymore.
Rohit
Comment 17
2015-06-12 04:36:39 PDT
Created
attachment 254793
[details]
Patch
Csaba Osztrogonác
Comment 18
2015-09-14 10:54:58 PDT
Comment on
attachment 253702
[details]
Patch Cleared review? from obsolete
attachment 253702
[details]
so that this bug does not appear in
http://webkit.org/pending-review
. If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).
Kent Tamura
Comment 19
2015-09-14 14:10:53 PDT
Comment on
attachment 254793
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=254793&action=review
> Source/WebCore/html/HTMLInputElement.cpp:862 > + dispatchFormControlChangeEvent();
This causes a regression. See
https://code.google.com/p/chromium/issues/detail?id=528985
Chris Dumez
Comment 20
2015-09-14 14:14:37 PDT
(In reply to
comment #19
)
> Comment on
attachment 254793
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=254793&action=review
> > > Source/WebCore/html/HTMLInputElement.cpp:862 > > + dispatchFormControlChangeEvent(); > > This causes a regression. See >
https://code.google.com/p/chromium/issues/detail?id=528985
Thanks Tamura.
Chris Rebert
Comment 21
2015-10-02 16:32:57 PDT
See also HTML spec bug:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28985
Chris Rebert
Comment 22
2016-02-02 15:41:38 PST
(In reply to
comment #19
)
> Comment on
attachment 254793
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=254793&action=review
> > > Source/WebCore/html/HTMLInputElement.cpp:862 > > + dispatchFormControlChangeEvent(); > > This causes a regression. See >
https://code.google.com/p/chromium/issues/detail?id=528985
The regression was subsequently fixed:
https://code.google.com/p/chromium/issues/detail?id=528985#c4
https://src.chromium.org/viewvc/blink?view=revision&revision=202190
Lucas Forschler
Comment 23
2019-02-06 09:19:17 PST
Mass move bugs into the DOM component.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug