Bug 89041 - Click events from child element of disabled <button> incorrectly bubble
Summary: Click events from child element of disabled <button> incorrectly bubble
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.6
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/sjRtk/3/
Depends on:
Reported: 2012-06-13 15:10 PDT by john van horn
Modified: 2018-08-31 09:57 PDT (History)
3 users (show)

See Also:

html/js example of incorrect bubbling (747 bytes, text/html)
2012-06-13 15:11 PDT, john van horn
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description john van horn 2012-06-13 15:10:37 PDT
If a disabled <button> element contains a child element, then clicking on the child causes a click event to bubble up to the button's containing element.


<div id="btn-container">
    <button disabled>
        <i class="icon">XX</i>

If an event listener is added to #btn-container for 'click' events, then clicking on the <i> element ("XX", contained in disabled button) causes the handler to be invoked. Clicking on the button's other content ("disabled-icon" text) does not invoke the handler.
Comment 1 john van horn 2012-06-13 15:11:19 PDT
Created attachment 147422 [details]
html/js example of incorrect bubbling
Comment 2 Pablo Flouret 2012-06-20 17:09:15 PDT
html spec says about disabled form controls and events:

"A form control that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on the element."


The problem seems to be that the event's target is set to the button's child element, other browsers have the button as target.
Not sure what code is really to blame, hit testing?

As an aside, all browsers seem to be doing something different with regards to mouse events and disabled form controls, maybe that's why the spec only talks about the click events, where all browsers sort of agree.

I used something like this to play around, http://jsfiddle.net/EqfZ9/1/
Comment 3 Alexey Proskuryakov 2012-10-19 13:14:38 PDT
See also: bug 15696, bug 99712.