fix(Popover): better handle esc when dialog is open#4788
Conversation
🦋 Changeset detectedLatest commit: 43ea676 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 |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)✅ Unit Test PR creation complete.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
✅ Created PR with unit tests: #4861 |
Fix: Popover no longer closes on "Escape" when a Dialog element is open above it