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

[FEATURE] Nested Layer onOutsideClick enabled by option #63

Open
ch1ll0ut1 opened this issue Mar 4, 2021 · 2 comments
Open

[FEATURE] Nested Layer onOutsideClick enabled by option #63

ch1ll0ut1 opened this issue Mar 4, 2021 · 2 comments

Comments

@ch1ll0ut1
Copy link

Is your feature request related to a problem? Please describe.
I am using react-laag for several nested layers in a rich text editor.
First overlayer is a hovering menu above selected text or another menu for custom rich content.
All menus have buttons that can either perform action or open popover/layers on top of that (positioned relative to the clicked button).
Everything works great, react-laag is amazing for this kind of custom menus and overlays.
There is only one tiny problem now, the first layer can be persistent as long as the cursor is in the content. And layer children´s "onOutsideClick" is ignored and so they dont close when the user clicks around the app. Which I found out is currently intentionally done when a child layer has a parent.

Describe the solution you'd like
Add a option to useLayer to disable the ignoring of onOutsideClick events, so that child layers call as expected onOutsideClick
(If it would be me I would make that the default behaviour as well, since it appears at first to be a bug and requires a careful read through of the documentation to find out that this is the intended behaviour.)

@pigpudle
Copy link

Hi @ch1ll0ut1 ! Have you solved this?
Could you please share your solution if you had solved this :)

@pigpudle
Copy link

I found react-laag docs saying that onOutsideClick only has effect on root-layer.
So I managed this issue by wrapping nested element in its own onClickOutside adapter (from react-cool-onclickoutside for example).

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

No branches or pull requests

2 participants