[Webkit-unassigned] [Bug 218923] New: "click" event is not bubbling when adding a listener to a shadowRoot

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 13 15:11:45 PST 2020


https://bugs.webkit.org/show_bug.cgi?id=218923

            Bug ID: 218923
           Summary: "click" event is not bubbling when adding a listener
                    to a shadowRoot
           Product: WebKit
           Version: Safari 14
          Hardware: iPhone / iPad
                OS: iOS 13
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: UI Events
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: lionel.seguin at contentsquare.com

Created attachment 414097

  --> https://bugs.webkit.org/attachment.cgi?id=414097&action=review

File to launch on iOS nothing will happen by clicking on "CLICK ME"

This issue is happening only on iOS.

First you have to create the following DOM (the file attached is doing it):

<my-custom-element onclick="alert('CUSTOM BUTTON CLICKED')">
  #shadowRoot
     <span>
       "button is:"
       <slot></slot>
     </span>
  "Some Text"
</my-custom-element>

when the dom is created you can add a listener to the shadowRoot like this:

```javascript
document.querySelector('my-custom-element')
  .shadowRoot
  .addEventListener('click', () => { alert('CLICK EVENT FIRED'); });
```

now you can press the "span" and you will see no event is fired. There is no alert at all displayed.

The issue is related to the listener we have on the shadowRoot. If we don't have it the first listener is working well.


Another strange behaviour is if you had an other listener on the "span" like this:

```javascript
document.querySelector('my-custom-element')
  .shadowRoot
  .querySelector('span')
  .addEventListener('click', () => { alert('SPAN CLICKED'); });
```

Now if you press the button the probleme is fixed the 3 handlers are well called as expected.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201113/26638ffe/attachment.htm>


More information about the webkit-unassigned mailing list