Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve event delegation handling of open shadow DOM #315

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

olivercoad
Copy link

Fix solidjs/solid#2103

Adds unit tests for event delegation with open shadow dom.

  • Set target when traversing shadow root hosts
  • Uses composedPath so that delegated handlers inside the shadow dom get events from within slots
  • Doesn't retarget when traversing a portal with useShadow

When a portal mount is in shadow dom (and possibly some other cases when mixing portals and shadow dom), it can't naturally end with the original target, so it needs the explicit retarget at the end to handle that edge case.

Mixing portals and shadow dom (especially slots) may have some interesting interactions, I've tried to make it have the most intuitive behaviour even when that doesn't follow the standard because bubbling through portals is already non standard behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Events from inside web components with shadow root mode open have wrong target
1 participant