Detect target inside a shadow root for clickOutsideHandler #7743
Labels
squad:core
Issue to be handled by the Core team.
type:improvement
This issue reports a possible enhancement of an existing feature.
Milestone
📝 Provide a description of the improvement
clickOutsideHandler
currently works by checking whether the click target is one of the context elements. However, when the editor is placed in a shadow root, any click events on the editor are retargeted such that they appear to target the entire editor and not a specific element within the editor.Because of event retargeting,
clickOutsideHandler
doesn't function as expected when the editor is in a shadow root. For example,clickOutsideHandler
is used to detect when a click outside a dropdown view occurs so that the dropdown view can be collapsed. However, in a shadow root, an event clicking on the dropdown view itself is retargeted so thattarget
is not the dropdown view, and the click triggers dropdown view to be closed. Looking at the event's composed path instead of justtarget
can reveal whether the original target included the context element(s).📃 Other details
Improving this would be a step in supporting running the editor in shadow DOM (#3891), making a Web Component for CKEditor more possible (#1483)!
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: