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. Example: <div id="btn-container"> <button disabled> <i class="icon">XX</i> disabled-icon </button> </div> 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.
Created attachment 147422 [details] html/js example of incorrect bubbling
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." http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#attr-fe-disabled 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/
See also: bug 15696, bug 99712.
<rdar://problem/88605979>
I am able to reproduce this bug in Safari 15.6.1 and Safari Technology Preview 151 using attached test case, where clicking "xx" on disabled button will trigger event and show up in Console: [Log] click btn-container – MouseEvent {isTrusted: true, screenX: 544, screenY: 168, …} (attachment.cgi, line 23)...... While in case of other browsers (Chrome Canary 106 and Firefox Nightly 105), I am unable to reproduce this issue. I am going to mark this bug from "Unconfirmed" to "New". Thanks!