Replies: 1 comment 1 reply
-
|
Hey! Yep you are correct, corvu in its state hasn't put any effort into making sure it supports the Shadow DOM. Generally, I'm open to investigating how much effort this would be to add and support. I don't have a lot of experience working with Shadow DOMs and the caveats they bring with them. It would be best to make sure that every primitive and utility works in the Shadow DOM. Depending on how much complexity this would add, I'd be happy to maintain support for it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The current implementation of document event handling uses
event.targetas the event target. This method works for DOM elements located in plain old DOM.When I try to render a component inside the Shadow DOM, all events intercepted from the outside (via document.addEventListener) will have an
event.target===hostDOM element. This leads to incorrect behavior of components such as Dialog, Drawer.I'm not sure if there are other places that are broken when using shadow dom. Changes may be required in other parts of the code, so I started a discussion - are there plans to maintain compatibility with shadow dom?
Example
https://stackblitz.com/edit/corvu-shadow-dom-issue?file=src%2Findex.tsx
Proposed solution
I suggest using
event.composedPath().at(0)instead ofevent.targetin all places where we need target which triggered event. According to the specification, there will be the required element even from shadow dom.For example
Replacing all occurrences
const target = event.targetwithconst target = event.composedPath().at(0)resolves issue with scrolling.I would like to make PR if you approve this solution
Almost similar issue in react-select: JedWatson/react-select#3680 (comment)
Beta Was this translation helpful? Give feedback.
All reactions