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

[Overlay] Nested overlays close all overlays when inner content is clicked #2030

Closed
tyscorp opened this issue Jan 24, 2018 · 1 comment
Closed

Comments

@tyscorp
Copy link
Contributor

tyscorp commented Jan 24, 2018

Bug report

  • Package version(s): v1.x and v2.x
  • Browser and OS versions: Irrelevant

Steps to reproduce

  1. Create nested overlays/popovers
  2. Click the content of a nested popover.

Screencast of the issue on the docs here.

Actual behavior

All the popovers close.

Expected behavior

All popovers remain open.

I have fixed this locally by patching Overlay. My solution works by propagating depth via context. Every overlay reads the current depth and then sets the new depth to +1. I then override handleDocumentClick and if a nested overlay was clicked, only close the descendants.

The source code for this patch is here. I currrently use the DOM to store data but I think another solution would be possible.

I'd be interested in making a PR with a better solution if wanted.

@giladgray
Copy link
Contributor

💯 bug report! thanks for the screencast and patch link!

oof this is some nasty interaction, cuz each nested Overlay is in a separate Portal.
we already maintain Overlay.overlayStack with refs of nested Overlay components. I wonder if that could be used instead of context / DOM data?

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

No branches or pull requests

3 participants