This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28985 - Ordering of checkbox click & change events doesn't match reality
Summary: Ordering of checkbox click & change events doesn't match reality
Status: RESOLVED INVALID
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://jsfiddle.net/cvrebert/Lxwc1eah...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-23 08:37 UTC by Chris Rebert
Modified: 2016-01-18 10:09 UTC (History)
3 users (show)

See Also:


Attachments

Description Chris Rebert 2015-07-23 08:37:23 UTC
To repro:
1. Open http://jsfiddle.net/cvrebert/Lxwc1eah/show/
2. Open the console
3. Click the webpage's checkbox
4. Observe the console output

In Chrome, Safari, and IE11, the output is:
  change
  click
In Firefox only, the output is:
  click
  change

The majority position is that, when the user clicks an <input type="checkbox">, the `change` event gets fired before the `click` event. Firefox does the reverse. The spec currently agrees with Firefox but disagrees with the majority.


Here are the relevant portions of the spec:

https://html.spec.whatwg.org/multipage/interaction.html#run-authentic-click-activation-steps
When a user agent is to [[[run authentic click activation steps]]] for a given event event, it must follow these steps:
    [...]
    6. Dispatch event (the required `click` event) at target.
       If there is an element e and the `click` event is not canceled, [[[run post-click activation steps]]] on element e.

https://html.spec.whatwg.org/multipage/interaction.html#run-post-click-activation-steps
When a user agent is to [[[run post-click activation steps]]] on an element, it must run the [[[activation behaviour]]] defined for that element, if any.

https://html.spec.whatwg.org/multipage/forms.html#checkbox-state-(type=checkbox):activation-behaviour
4.10.5.1.16 Checkbox state (type=checkbox)
    The [[[activation behaviour]]] is to fire a simple event that bubbles named `input` at the element and then fire a simple event that bubbles named `change` at the element.
Comment 1 Chris Rebert 2016-01-03 07:57:09 UTC
Safari 9.0.2's behavior is unchanged.
MS Edge behaves the same as IE11.
Chrome 47 has apparently switched to behaving like Firefox.
Comment 2 Chris Rebert 2016-01-03 07:57:55 UTC
Bloody dropdowns..
Comment 3 Chris Rebert 2016-01-03 08:08:19 UTC
And `click` comes first in Opera 12.
Comment 4 Chris Rebert 2016-01-18 09:57:18 UTC
Filed MS Edge bug:
https://connect.microsoft.com/IE/feedback/details/2255779
Comment 5 Chris Rebert 2016-01-18 10:09:47 UTC
Deeming this to now be a bug in the remaining browsers rather than the spec itself, since 2 browsers now match the spec and Safari appears open to changing to match the spec (hopefully Edge will respond positively too).
(And the spec's behavior is certainly more logical than the alternative behavior, so now that compat is less of a factor, there's no reason to want the spec to change.)