everweij / react-laag

Hooks to build things like tooltips, dropdown menu's and popovers in React

Home Page:https://www.react-laag.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] shadow DOM not working via environment parameter

elseee opened this issue · comments

Describe the bug
I'm trying to use the useLayer hook in the shadow DOM. I succeeded in getting the correct styling by using the container parameter. Some of the behaviour, like clicking outside the layer, still doesn't work though. This is happening because event listeners are added to the window and not in the shadow DOM itself. The environment seems to be a parameter that could fix this issue, however it has to be of type Window and it throws an error if the root element of the shadow DOM is used. (see screenshot).

To Reproduce
Steps to reproduce the behavior:

  1. Add useLayer hook into an app which uses shadow DOM
  2. Provide container in shadow DOM
  3. Event handlers aren't added to the shadow DOM, but to the window

Expected behavior
Provide a way to add event listeners within the shadow DOM.

Screenshots
Screenshot 2022-03-10 at 13 53 07