<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>89041</bug_id>
          
          <creation_ts>2012-06-13 15:10:37 -0700</creation_ts>
          <short_desc>Click events from child element of disabled &lt;button&gt; incorrectly bubble</short_desc>
          <delta_ts>2023-01-26 21:04:17 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>UI Events</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.6</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=99712</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=15696</see_also>
          <bug_file_loc>http://jsfiddle.net/sjRtk/3/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>251246</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="john van horn">jmvanhorn</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>akeerthi</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>bill</cc>
    
    <cc>cdumez</cc>
    
    <cc>me</cc>
    
    <cc>pf</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>648499</commentid>
    <comment_count>0</comment_count>
    <who name="john van horn">jmvanhorn</who>
    <bug_when>2012-06-13 15:10:37 -0700</bug_when>
    <thetext>If a disabled &lt;button&gt; element contains a child element, then clicking on the child causes a click event to bubble up to the button&apos;s containing element.

Example:

&lt;div id=&quot;btn-container&quot;&gt;
    &lt;button disabled&gt;
        &lt;i class=&quot;icon&quot;&gt;XX&lt;/i&gt;
        disabled-icon
    &lt;/button&gt;
&lt;/div&gt;

If an event listener is added to #btn-container for &apos;click&apos; events, then clicking on the &lt;i&gt; element (&quot;XX&quot;, contained in disabled button) causes the handler to be invoked. Clicking on the button&apos;s other content (&quot;disabled-icon&quot; text) does not invoke the handler.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>648500</commentid>
    <comment_count>1</comment_count>
      <attachid>147422</attachid>
    <who name="john van horn">jmvanhorn</who>
    <bug_when>2012-06-13 15:11:19 -0700</bug_when>
    <thetext>Created attachment 147422
html/js example of incorrect bubbling</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>654025</commentid>
    <comment_count>2</comment_count>
    <who name="Pablo Flouret">pf</who>
    <bug_when>2012-06-20 17:09:15 -0700</bug_when>
    <thetext>html spec says about disabled form controls and events:

&quot;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.&quot;

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&apos;s target is set to the button&apos;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&apos;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/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>746586</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-19 13:14:38 -0700</bug_when>
    <thetext>See also: bug 15696, bug 99712.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838477</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-02-07 18:32:16 -0800</bug_when>
    <thetext>&lt;rdar://problem/88605979&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892603</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-19 22:58:23 -0700</bug_when>
    <thetext>I am able to reproduce this bug in Safari 15.6.1 and Safari Technology Preview 151 using attached test case, where clicking &quot;xx&quot; 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 &quot;Unconfirmed&quot; to &quot;New&quot;. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>147422</attachid>
            <date>2012-06-13 15:11:19 -0700</date>
            <delta_ts>2012-06-13 15:11:19 -0700</delta_ts>
            <desc>html/js example of incorrect bubbling</desc>
            <filename>webkitbug.html</filename>
            <type>text/html</type>
            <size>747</size>
            <attacher name="john van horn">jmvanhorn</attacher>
            
              <data encoding="base64">PGRpdiBpZD0iYnRuLWNvbnRhaW5lciI+CiAgICA8YnV0dG9uPmVuYWJsZWQ8L2J1dHRvbj4KICAg
IDxidXR0b24gaWQ9ImRpc2FibGVkLWJ1dHRvbiIgZGlzYWJsZWQ+CiAgICAgICAgPGkgY2xhc3M9
Imljb24iPlhYPC9pPgogICAgICAgIGRpc2FibGVkLWljb24KICAgIDwvYnV0dG9uPgo8L2Rpdj4K
CjxzY3JpcHQ+CgovKgoKMS4gQ2xpY2sgb24gI2Rpc2JsZWQtYnV0dG9uJ3MgPGk+IGNoaWxkIGVs
ZW1lbnQgKCJYWCIpLi4uIAogICBhICdjbGljaycgZXZlbnQgYnViYmxlcyB0byAjYnRuLWNvbnRh
aW5lcgogICAKMi4gQ2xpY2sgb24gI2Rpc2FibGVkLWJ1dHRvbidzIHRleHQgY29udGVudCAKICAg
KCJkaXNhYmxlZC1pY29uIikuLi4gbm8gJ2NsaWNrJyBldmVudCBidWJibGVzIHRvIAogICAjYnRu
LWNvbnRhaW5lcgogICAKKi8KdmFyIGNvbnRhaW5lciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlk
KCdidG4tY29udGFpbmVyJyk7CmNvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGZ1
bmN0aW9uKGUpewogICAgY29uc29sZS5sb2coJ2NsaWNrIGJ0bi1jb250YWluZXInLCBlKTsKfSk7
Cgp2YXIgZGlzYWJsZWRCdG4gPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZGlzYWJsZWQtYnV0
dG9uJyk7CmRpc2FibGVkQnRuLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oZSl7
CiAgICBjb25zb2xlLmxvZygnY2xpY2sgZGlzYWJsZWQtYnV0dG9uJywgZSk7Cn0pOwoJCjwvc2Ny
aXB0PgoK
</data>

          </attachment>
      

    </bug>

</bugzilla>