Repository navigation
[dialog][popover][drawer] Keep generated ids when id is undefined - #6343
Merged
Merged
Conversation
…fined
Dialog.Popup (also used by AlertDialog), Popover.Popup and Drawer.Popup
put the generated id in their internal props and merged elementProps
after it, so an explicit id={undefined} (common when a wrapper forwards
an optional id) left the popup without an id and the open trigger
without aria-controls. Drawer.Popup already computed
elementProps.id ?? defaultPopupId but the spread undid it. Take id out
of the props and use idProp ?? defaultPopupId, as Menu.Popup and the
triggers already treat an undefined id like an omitted one.
…efined
Popover.Title and Popover.Description passed elementProps.id to
useBaseUiId but left id in elementProps, so an explicit id={undefined}
(common when a wrapper forwards an optional id) overrode the generated
id on the element while the store still held it. The popup's
aria-labelledby and aria-describedby then pointed at an id no element
had. Take id out of the props, as Dialog.Title and Dialog.Description
already do.
henryqdineen
requested review from
atomiks,
colmtuite,
flaviendelangle,
jjenzz and
michaldudak
as code owners
November 24, 2026 20:24
commit: |
Bundle size
PerformanceNo regressions in 36 benchmarks · precise to ±8.5% (±17.9% at worst) · ran 3m 14s · details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
flaviendelangle
approved these changes
Nov 25, 2026
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.
We hit this in a design system that wraps Base UI. Its components take optional per-part ids and forward them, so a dialog with no id passes
id={undefined}toDialog.Popup. Our Playwright tests find a dialog through its trigger'saria-controls, and on our default dialog the trigger didn't have one. Checking the other parts turned up the same problem in Popover and Drawer.The caller's props merge last and
mergePropsletsundefinedwin, so the generated id is erased:Dialog.Popup(andAlertDialog),Popover.Popup,Drawer.Popup: no popup id, so noaria-controls.Popover.Title,Popover.Description: the popup'saria-labelledbyoraria-describedbypoints at an id no element has.Menu.Popup,Dialog.Title,Dialog.Descriptionand the triggers already treatid={undefined}like an omittedid, and Radix recently made the same change for its Dialog in radix-ui/primitives#4210. This PR does the same inDialog.Popup,Popover.Popup,Drawer.Popup,Popover.TitleandPopover.Description: takeidout of the props and fall back to the generated id.mergePropsis unchanged, soundefinedstill wins for other props (aria-labelledby={undefined}still drops the automatic label).Tests: each part gets an
id={undefined}case that fails without the fix in jsdom and Chromium, plus custom-id cases forPopover.Title,Popover.DescriptionandDrawer.Popup, which had none.Not fixed here, same pattern:
Select.Popup/Select.List,Combobox.List/Combobox.Popup, and probablyDrawer.SwipeArea. That's why the popup tests are per file rather than inpopupConformanceTests, where they'd also fail for Select and Combobox. Happy to follow up.🤖 Generated with Claude Code