ui: Forward style and className on *.Popup to inner Base UI Popup#77693
Conversation
…opup
`Popover.Popup`, `Tooltip.Popup`, and `Select.Popup` previously forwarded
`style` and `className` to the outer Base UI `Positioner`. Now that the
`portal` prop pattern lets consumers customize the wrapping `Portal`
directly, the silent forwarding to `Positioner` is no longer needed and
brings these wrappers in line with `Dialog.Popup`, `AlertDialog.Popup`,
and `Drawer.Popup`, which already forward to the popup element.
Z-index is still applied to the `Positioner` via the
`--wp-ui-<overlay>-z-index` CSS variable, which can be set on a wrapping
element or per-instance through `<Overlay.Portal style={ { … } } />`.
Made-with: Cursor
|
Size Change: 0 B Total Size: 7.78 MB ℹ️ View Unchanged
|
|
Flaky tests detected in d552782. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24998242571
|
After the previous commit aligned `Popover.Popup`, `Tooltip.Popup`, and `Select.Popup` with their silent siblings (`Dialog`, `AlertDialog`, `Drawer`), the JSDoc blocks added to the three `PopupProps` types only documented behavior that is no longer surprising. The sibling overlays carry no such doc block, and the z-index escape hatch is now documented uniformly via the Storybook stories aligned in #77648. Also let `style` flow to the inner Base UI `Popup` implicitly via `...props` instead of destructuring it just to re-pass it unchanged. Made-with: Cursor
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…7693) * ui: Forward `style` and `className` from `*.Popup` to inner Base UI Popup `Popover.Popup`, `Tooltip.Popup`, and `Select.Popup` previously forwarded `style` and `className` to the outer Base UI `Positioner`. Now that the `portal` prop pattern lets consumers customize the wrapping `Portal` directly, the silent forwarding to `Positioner` is no longer needed and brings these wrappers in line with `Dialog.Popup`, `AlertDialog.Popup`, and `Drawer.Popup`, which already forward to the popup element. Z-index is still applied to the `Positioner` via the `--wp-ui-<overlay>-z-index` CSS variable, which can be set on a wrapping element or per-instance through `<Overlay.Portal style={ { … } } />`. Made-with: Cursor * ui: Drop redundant `*.PopupProps` JSDoc and forward `style` implicitly After the previous commit aligned `Popover.Popup`, `Tooltip.Popup`, and `Select.Popup` with their silent siblings (`Dialog`, `AlertDialog`, `Drawer`), the JSDoc blocks added to the three `PopupProps` types only documented behavior that is no longer surprising. The sibling overlays carry no such doc block, and the z-index escape hatch is now documented uniformly via the Storybook stories aligned in #77648. Also let `style` flow to the inner Base UI `Popup` implicitly via `...props` instead of destructuring it just to re-pass it unchanged. Made-with: Cursor --- Co-authored-by: ciampo <[email protected]> Co-authored-by: mirka <[email protected]>

Follow-up to #77648 (comment).
What?
Make
styleandclassNameonPopover.Popup,Tooltip.Popup, andSelect.Popupforward to the inner Base UIPopup(matchingDialog.Popup,AlertDialog.Popup, andDrawer.Popup) instead of the outerPositioner.Why?
The previous behavior was inconsistent across the overlay family and silently routed user props to a different element than the API name suggested. With every overlay now forwarding the same way, consumers can rely on a single mental model. Per-instance z-index overrides should use
<Overlay.Portal style={ { '--wp-ui-<overlay>-z-index': '9999' } } />(uniformly demonstrated by #77648).Forwarding contract before/after
Dialog.PopupPopupPopup(unchanged)AlertDialog.PopupPopupPopup(unchanged)Drawer.PopupPopupPopup(unchanged)Popover.PopupPositionerPopupTooltip.PopupPositionerPopupSelect.PopupPositionerPopupImplementation notes
classNameis destructured and merged with the internal popup class viaclsxbefore being passed to<_Overlay.Popup>.styleflows implicitly via...props..positionerCSS module class continues to ownz-index: var(--wp-ui-<overlay>-z-index, initial)(the positioner is the absolutely-positioned element, so z-index has to live there) and thebox-sizingreset, just without the userclassNamemixed in.PopupProps— the post-refactor behavior matches the silent siblings, so nothing surprising is left to document. The z-index escape hatch is documented uniformly via the Storybook stories aligned in ui: Align WithCustomZIndex Storybook examples across overlays #77648.Audit of other props going to
Positioner:align,alignOffset,anchor,arrowPadding,collisionAvoidance,collisionBoundary,collisionPadding,side,sideOffset,sticky) —Positioner-only Base UI props, correctly stay onPositioner.initialFocus,finalFocus— already correctly onPopup....propsrest — already correctly forwarded toPopup.So
styleandclassNamewere the only props going to the wrong element.Base UI CSS variables exposed by
Positioner(--available-height,--available-width,--anchor-width, …) cascade down and remain readable from the popup.Testing Instructions
npm run storybook:devPopover,Tooltip, andSelectstories — especiallyWithCustomZIndex— and confirm rendering and z-index override still work.npm run test:unit -- packages/ui/src/popover packages/ui/src/tooltip packages/ui/src/form/primitives/select— all suites pass.Testing Instructions for Keyboard
Open
Popover,Tooltip, andSelectstories and confirm keyboard interactions (Tab, Escape, arrow keys) are unchanged.Screenshots or screencast
N/A — no visible behavior change in default usage.
Made with Cursor and Opus 4.7