<?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>196457</bug_id>
          
          <creation_ts>2019-04-01 12:35:34 -0700</creation_ts>
          <short_desc>Slot click events not fired after visibility change</short_desc>
          <delta_ts>2019-04-02 14:31:25 -0700</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>Safari 12</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>148695</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="David">david.dalbusco</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1523009</commentid>
    <comment_count>0</comment_count>
    <who name="David">david.dalbusco</who>
    <bug_when>2019-04-01 12:35:34 -0700</bug_when>
    <thetext>I&apos;ve got a shadowed Web Components which exposes a slot. The visibility of the components&apos; elements change from &apos;hidden&apos; per default to &apos;visible&apos; when I call a method. 

After the visitility (css `visibility: hidden/visible`) as changed, the click event on the button which exposes a slot isn&apos;t triggered anymore.


```
&lt;button onClick={() =&gt; {this.toggleLink()}}&gt;
&lt;span&gt;H&lt;/span&gt;
&lt;/button&gt;
```

=&gt; click event ok even after visibility change

```
&lt;button onClick={() =&gt; {this.toggleLink()}}&gt;
&lt;slot name=&quot;hello&quot;&gt;&lt;/slot&gt;
&lt;/button&gt;

&lt;span slot=&quot;hello&quot;&gt;H&lt;/span&gt;
```

=&gt; no click event after the visibility change

Double checked, same code work in both Firefox and Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523172</commentid>
    <comment_count>1</comment_count>
      <attachid>366452</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-04-01 19:15:03 -0700</bug_when>
    <thetext>Created attachment 366452
Example (works)

Could you describe which element&apos;s visibility is getting changed? For example, click event works fine in the attached example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523233</commentid>
    <comment_count>2</comment_count>
    <who name="David">david.dalbusco</who>
    <bug_when>2019-04-01 22:57:11 -0700</bug_when>
    <thetext>Hi, thx for the feedback. Your example could work has it is not a shadowed (shadow DOM) components.

The problem occurs in a Web Component respectively in a shadowed DOM components.

If you modify the :host visibility or the first container visibility, in both case then the click event isn&apos;t triggered anymore if you click on the SLOTTED elements

&lt;my-components&gt; &lt;!-- If you change visibility on the host --&gt;
#shadow:root
&lt;div&gt; &lt;!-- Or if you change visibility on the first container --&gt;
&lt;button&gt;
&lt;slot name=&quot;test&quot;/&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;my-components&gt;


&lt;span slot=&quot;test&quot;&gt;In both case no click events&lt;/span&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523235</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-04-01 23:19:21 -0700</bug_when>
    <thetext>(In reply to David from comment #2)
&gt; Hi, thx for the feedback. Your example could work has it is not a shadowed
&gt; (shadow DOM) components.

?? The attached example totally uses shadow tree.

&gt; The problem occurs in a Web Component respectively in a shadowed DOM
&gt; components.
&gt; 
&gt; If you modify the :host visibility or the first container visibility, in
&gt; both case then the click event isn&apos;t triggered anymore if you click on the
&gt; SLOTTED elements
&gt; 
&gt; &lt;my-components&gt; &lt;!-- If you change visibility on the host --&gt;
&gt; #shadow:root
&gt; &lt;div&gt; &lt;!-- Or if you change visibility on the first container --&gt;
&gt; &lt;button&gt;
&gt; &lt;slot name=&quot;test&quot;/&gt;
&gt; &lt;/button&gt;
&gt; &lt;/div&gt;
&gt; &lt;my-components&gt;
&gt; 
&gt; 
&gt; &lt;span slot=&quot;test&quot;&gt;In both case no click events&lt;/span&gt;

Okay, the following example seems to work just fine:

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;
&lt;div id=&quot;host&quot; style=&quot;visibility: hidden&quot;&gt;&lt;span slot=&quot;hello&quot;&gt;H&lt;/span&gt;&lt;/div&gt;
&lt;button onclick=&quot;s = container.style; s.visibility = s.visibility == &apos;hidden&apos; ? &apos;visible&apos; : &apos;hidden&apos;&quot;&gt;Toggle&lt;/button&gt;
&lt;script&gt;

const shadowRoot = host.attachShadow({mode: &apos;closed&apos;});
shadowRoot.innerHTML = `
&lt;div id=&quot;container&quot;&gt;
    &lt;button onclick=&quot;alert(&apos;clicked!&apos;)&quot;&gt;
        &lt;slot name=&quot;hello&quot;&gt;&lt;/slot&gt;
    &lt;/button&gt;
&lt;/div&gt;`;
window.container = shadowRoot.getElementById(&apos;container&apos;);

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

Could you just give us a complete HTML file which reproduces this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523238</commentid>
    <comment_count>4</comment_count>
    <who name="David">david.dalbusco</who>
    <bug_when>2019-04-01 23:52:02 -0700</bug_when>
    <thetext>I&apos;ll try later today to reproduce the issue in a dummy project and will provide it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523265</commentid>
    <comment_count>5</comment_count>
    <who name="David">david.dalbusco</who>
    <bug_when>2019-04-02 03:50:45 -0700</bug_when>
    <thetext>Yes you are right this issue could be closed, it isn&apos;t a valid issue

Actually the problem of my component is probably another webkit related issue with the selection

Therefore this one could be close</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1523476</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2019-04-02 14:31:25 -0700</bug_when>
    <thetext>(In reply to David from comment #5)
&gt; Yes you are right this issue could be closed, it isn&apos;t a valid issue
&gt; 
&gt; Actually the problem of my component is probably another webkit related
&gt; issue with the selection
&gt; 
&gt; Therefore this one could be close

Great. Thanks for checking!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>366452</attachid>
            <date>2019-04-01 19:15:03 -0700</date>
            <delta_ts>2019-04-01 19:18:57 -0700</delta_ts>
            <desc>Example (works)</desc>
            <filename>shadow-click.html</filename>
            <type>text/html</type>
            <size>412</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPGRpdiBpZD0iaG9zdCIgc3R5bGU9InZpc2li
aWxpdHk6IGhpZGRlbiI+PHNwYW4gc2xvdD0iaGVsbG8iPkg8L3NwYW4+PC9kaXY+CjxidXR0b24g
b25jbGljaz0icyA9IGhvc3Quc3R5bGU7IHMudmlzaWJpbGl0eSA9IHMudmlzaWJpbGl0eSA9PSAn
aGlkZGVuJyA/ICd2aXNpYmxlJyA6ICdoaWRkZW4nIj5Ub2dnbGU8L2J1dHRvbj4KPHNjcmlwdD4K
CmNvbnN0IHNoYWRvd1Jvb3QgPSBob3N0LmF0dGFjaFNoYWRvdyh7bW9kZTogJ2Nsb3NlZCd9KTsK
c2hhZG93Um9vdC5pbm5lckhUTUwgPSBgPGJ1dHRvbiBvbmNsaWNrPSJhbGVydCgnY2xpY2tlZCEn
KSI+CjxzbG90IG5hbWU9ImhlbGxvIj48L3Nsb3Q+CjwvYnV0dG9uPmA7Cgo8L3NjcmlwdD4KPC9i
b2R5Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>