Skip to content

fix: Improve consistency of Popover --trigger-width#9913

Merged
devongovett merged 2 commits intomainfrom
popover-trigger-width
Apr 24, 2026
Merged

fix: Improve consistency of Popover --trigger-width#9913
devongovett merged 2 commits intomainfrom
popover-trigger-width

Conversation

@devongovett
Copy link
Copy Markdown
Member

Closes #9451, closes #5331

Updates the behavior of the Popover --trigger-width CSS variable so it works consistently. Instead of being set by each trigger component, it is now set within Popover. This means:

In addition, for ComboBox, we now position relative to the <Group> element wrapping the input and button, instead of trying to measure both and find the union of their bounding boxes. This provides better default behavior, especially in cases like multi-select ComboBoxes which also add a TagGroup to display the selected items. Previously the menu would move to be positioned near the input rather than the visual grouping around everything. If a Group is not rendered, we fall back to the old behavior.

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 11, 2026

Comment thread packages/react-aria-components/src/Popover.tsx
@nwidynski
Copy link
Copy Markdown
Contributor

@snowystinger Linking #7663 (comment) here, since I had previously addressed these issues. Did anything change as far as the original concerns go?

@devongovett
Copy link
Copy Markdown
Member Author

@nwidynski not sure I understand the concern. The PR you linked to is setting minWidth, whereas this is setting --trigger-width.

@nwidynski
Copy link
Copy Markdown
Contributor

It was more so directed towards the comment about adding a resize observer on every popover mount. I'm not too concerned personally about the performance of that, but linked it since it was mentioned.

Regarding the styling though, I'm not sure I follow why minWidth vs CSS variable matters, as far as the concern goes, which was that userland may be relying on the popover being smaller than the custom trigger element. If they styled with --trigger-width, their styling may regress , similarly as it would have with minWidth, no?

@devongovett
Copy link
Copy Markdown
Member Author

Oh. I actually think the performance might be better than before. Previously the resize observer would be active even when the popover was not open since it lived within the trigger. Now it only measures when the popover first opens.

re. minWidth I think the concern before was that setting a default minWidth via inline styles would override the user's css. doing it via a var is opt-in. nothing is really changing there.

@devongovett devongovett added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit ec7bc94 Apr 24, 2026
29 checks passed
@devongovett devongovett deleted the popover-trigger-width branch April 24, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants