[ui] Select: Default portal container to the wp compat overlay slot#78372
Conversation
Mirrors the Tooltip wiring from #78095: `Select.Portal` defaults its `container` to the `@wordpress/ui` compat overlay slot, so select popups (including `SelectControl`, which wraps `Select` internally) stack reliably above `@wordpress/components` overlays in mixed-library compositions. A caller-supplied `Select.Portal` `container` prop continues to take precedence.
d0b393d to
d7233c6
Compare
|
Size Change: 0 B Total Size: 7.97 MB ℹ️ View Unchanged
|
|
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. |
|
Flaky tests detected in d7233c6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25960989797
|
|
Ugh, I just noticed at that in the playground example with the |
This is a general issue of the Working on a tentative fix specifically for components portalled through the wp compat overlay (which only partially solves the issue) in #78407 |
What?
Wires
Select.Portal'scontainerto default to the wp compat overlay slot from #77851, mirroring theTooltipwiring landed in #78095.SelectControlwrapsSelectinternally, so it inherits the new behavior automatically.A caller-supplied
Select.Portalcontainercontinues to take precedence. No behavior change for@wordpress/ui-only consumers.Testing Instructions
Unit
npx jest --config=test/unit/jest.config.js --testPathPattern='packages/ui/src/form/(primitives/select|select-control)/test/index'Expected: 16 passing — 9 in
Select(6 pre-existing + 3 new) and 7 inSelectControl(5 pre-existing + 2 new), under awp compat overlay slotdescribe block.Storybook (cross-library stacking)
Open Playground / Debug fixtures / WP Compat Overlay Slot / Overlays inside @wordpress/components Modal (and the Popover variant): the
SelectandSelectControlpopups render above the components-side overlay, portaled into[data-wp-compat-overlay-slot].In any other (un-decorated) story — e.g. Design System / Components / Form / Primitives / Select / Default — confirm the dormant baseline: the popup uses the default portal container and
[data-wp-compat-overlay-slot]is absent from the DOM.Editor (auto-detect, real consumer)
The slot auto-detects
window.wp.components. To exercise the wiring end-to-end, swap an existing@wordpress/componentsSelectControlfor a@wordpress/uione — example below.Then
npm run dev, open a post, and open the Author select in the Settings sidebar. In DevTools, confirm the popup portals into[data-wp-compat-overlay-slot]ondocument.body.Example patch — Post Author select
@wordpress/ui'sSelectControltypes itemvalueasstring | nulland passes the matching item object (not the raw value) throughvalue/onValueChange.authorOptionsfrom core-data carry numeric IDs, hence theString/Numberconversions on the boundaries — they're a quirk of the example, not the wiring.Files touched
packages/ui/src/form/primitives/select/portal.tsx— the wiring itself.packages/ui/src/form/primitives/select/test/index.test.tsx— 3 new tests under awp compat overlay slotdescribe block.packages/ui/src/form/select-control/test/index.test.tsx— 2 new tests covering the inherited wiring.storybook/stories/playground/wp-compat-overlay-slot.story.jsx— extends the existing cross-library demo withSelectandSelectControlalongsideTooltip.Next Steps
Continue wiring the remaining
@wordpress/uioverlays onto the slot in subsequent PRs.Use of AI Tools
Authored with Cursor (Claude). Author reviewed all changes.