fix(ui): use portals for popup to prevent clipping, improve keyboard navigation#14910
Merged
fix(ui): use portals for popup to prevent clipping, improve keyboard navigation#14910
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
Contributor
|
Thank you so much, everyone involved in making this happen. Excellent work Alessio! |
paulpopus
previously approved these changes
Dec 15, 2025
paulpopus
approved these changes
Dec 15, 2025
Contributor
|
🚀 This is included in version v3.69.0 |
zubricks
pushed a commit
that referenced
this pull request
Jan 6, 2026
…navigation (#14910) Previously, the Popup contents were displayed relative to the Popup trigger button. This caused the Popup contents to be hidden if the parent element has `overflow: hidden`, which was the case for doc_controls on smaller screen sizes (this PR adds an e2e test that previously failed). This PR refactors the Popup component to use `createPortal`, rendering the popup content directly to `document.body` to avoid clipping issues. ## Before https://github.com/user-attachments/assets/c1cc341a-2295-45b6-89d0-7e89866e5bfd ## After https://github.com/user-attachments/assets/2eb0d8b5-105e-468b-bd66-8ef8261a6306 While refactoring, I also improved the keyboard navigation for popups: | Feature | Before | After | |---------|--------|-------| | Tab cycling | Exited popup after last button | Cycles and goes back to first button | | Escape key | Did nothing | Closes popup and returns focus to trigger | | Arrow keys | Scrolled the page | Navigates between buttons (↑/↓) | | Button focus styling | Bad | Good | | `<a>` elements | Skipped during navigation | Included in keyboard navigation | ## Keyboard navigation before https://github.com/user-attachments/assets/9d212c90-7759-42cf-ad37-d7ee7dc64c5d ## Keyboard navigation after https://github.com/user-attachments/assets/dbc7d647-b58b-4e5b-928c-a6f3fdab6348
teastudiopl
pushed a commit
to teastudiopl/payload
that referenced
this pull request
Jan 8, 2026
…navigation (payloadcms#14910) Previously, the Popup contents were displayed relative to the Popup trigger button. This caused the Popup contents to be hidden if the parent element has `overflow: hidden`, which was the case for doc_controls on smaller screen sizes (this PR adds an e2e test that previously failed). This PR refactors the Popup component to use `createPortal`, rendering the popup content directly to `document.body` to avoid clipping issues. ## Before https://github.com/user-attachments/assets/c1cc341a-2295-45b6-89d0-7e89866e5bfd ## After https://github.com/user-attachments/assets/2eb0d8b5-105e-468b-bd66-8ef8261a6306 While refactoring, I also improved the keyboard navigation for popups: | Feature | Before | After | |---------|--------|-------| | Tab cycling | Exited popup after last button | Cycles and goes back to first button | | Escape key | Did nothing | Closes popup and returns focus to trigger | | Arrow keys | Scrolled the page | Navigates between buttons (↑/↓) | | Button focus styling | Bad | Good | | `<a>` elements | Skipped during navigation | Included in keyboard navigation | ## Keyboard navigation before https://github.com/user-attachments/assets/9d212c90-7759-42cf-ad37-d7ee7dc64c5d ## Keyboard navigation after https://github.com/user-attachments/assets/dbc7d647-b58b-4e5b-928c-a6f3fdab6348
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11456
Fixes #14492
Fixes #14744
Fixes #14965
Previously, the Popup contents were displayed relative to the Popup trigger button. This caused the Popup contents to be hidden if the parent element has
overflow: hidden, which was the case for doc_controls on smaller screen sizes (this PR adds an e2e test that previously failed).This PR refactors the Popup component to use
createPortal, rendering the popup content directly todocument.bodyto avoid clipping issues.Before
Screenshot.2025-12-12.at.12.31.29.mp4
After
Screenshot.2025-12-12.at.19.45.39.mp4
While refactoring, I also improved the keyboard navigation for popups:
<a>elementsKeyboard navigation before
Screenshot.2025-12-12.at.19.52.35.mp4
Keyboard navigation after
Screenshot.2025-12-12.at.19.57.25.mp4