fix(Popover): better handle esc when dialog is open#4788
fix(Popover): better handle esc when dialog is open#4788eirikbacker wants to merge 5 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: c227c27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Preview deployments for this pull request: storybook - |
There was a problem hiding this comment.
Pull request overview
This PR updates the React Popover component’s Escape-key handling so it won’t close when another top-layer UI (notably an open Dialog) is above it, aligning behavior with expected top-layer semantics.
Changes:
- Update Popover Escape-key handler to only close when the Popover is considered top-layer.
- Add
isTopLayer(...)helper to detect when a Dialog / other popover is above the current Popover. - Add Storybook scenarios for Dropdown involving adjacent dialogs and nested dropdowns, plus a changeset entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/react/src/components/popover/popover.tsx | Changes Escape handling to respect top-layer state and adds isTopLayer detection helper. |
| packages/react/src/components/dropdown/dropdown.stories.tsx | Adds Storybook stories to exercise dialog adjacency and nested dropdown scenarios. |
| .changeset/strange-yaks-burn.md | Adds a patch changeset describing the Popover Escape behavior fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
mimarz
left a comment
There was a problem hiding this comment.
Can we add a test for this? 🙏
Please do 🤗 but, we should find another way to handle this, using |
Fix: Popover no longer closes on "Escape" when a Dialog element is open above it