WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
218923
iOS: click event doesn't get dispatched when there is a click event listener on ShadowRoot
https://bugs.webkit.org/show_bug.cgi?id=218923
Summary
iOS: click event doesn't get dispatched when there is a click event listener ...
Lionel Seguin
Reported
2020-11-13 15:11:45 PST
Created
attachment 414097
[details]
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.
Attachments
File to launch on iOS nothing will happen by clicking on "CLICK ME"
(902 bytes, text/html)
2020-11-13 15:11 PST
,
Lionel Seguin
no flags
Details
WIP
(1.07 KB, patch)
2022-07-03 02:13 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Lionel Seguin
Comment 1
2020-11-14 05:33:25 PST
The biggest impact of this issue is when a third party script is capturing events coming from a shadow root, it impacts the initial behaviour of the custom component.
Lionel Seguin
Comment 2
2020-11-14 05:49:51 PST
Another information. Attaching any of those events to the shadowRoot will change the initial component behaviour: - mouseover - click - mousedown - mouseup - mousemove
Smoley
Comment 3
2020-11-16 18:33:07 PST
Thanks for filing. I can reproduce this with the provided test case on iOS 13.6.1 and the current iOS 14.3 beta.
Radar WebKit Bug Importer
Comment 4
2020-11-16 18:33:16 PST
<
rdar://problem/71468598
>
Ryosuke Niwa
Comment 5
2022-07-03 02:11:52 PDT
This was a bizarre bug! It all comes down to WebPage::commitPotentialTap failing to dispatch click event because ShadowRoot doesn't have a renderer.
Ryosuke Niwa
Comment 6
2022-07-03 02:13:32 PDT
Created
attachment 460637
[details]
WIP
Ryosuke Niwa
Comment 7
2022-07-03 13:36:25 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/2043
EWS
Comment 8
2022-07-03 16:37:21 PDT
Committed
252107@main
(b01e40564c21): <
https://commits.webkit.org/252107@main
> Reviewed commits have been landed. Closing PR #2043 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug