Repository navigation
[combobox] Keep portalled popup content open - #5334
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,101.32 ms -18.90 ms(-1.7%) | Renders: 78 (+0) | Paint: 1,726.02 ms -21.78 ms(-1.2%)
14 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
PR reviewNo merge-blocking regression. The new Popup/List ownership split leaves a pre-existing modal focus bug in place, but this PR provides a natural and very small place to correct it. Bugs (1)1. ℹ️ Move the focus-manager marker to PopupLocation: const listProps = React.useMemo(
() => mergeProps(FOCUSABLE_POPUP_PROPS, listNavigation.floating, role.floating),
[listNavigation.floating, role.floating],
);
This behavior already exists on Failure scenario: Render a modal Combobox with Input, List, and a sibling button inside Popup. After tabbing from Input to the button, the next Tab leaves focus on the hidden focus guard instead of wrapping to Input. Fix: Apply VerdictApprove - the focus issue is pre-existing, though this ownership refactor is the cleanest place to address it. 🤖 Review generated with Codex |
efdb235 to
8e08886
Compare
|
@atomiks Thanks for taking a look. I've addressed what Codex mentioned.
(The failing browser test looks like an unrelated flake.) |
|
@obeattie thanks for the fix! The info point Codex posted above was a thought I personally had when looking at the diff, I got it to investigate to format it and post for review. In the process it found the modal bug
Yes unfortunately these have been popping up quite a bit, need to look into it. |
Changes
Combobox previously attached its dismissal handlers to
Combobox.List. As a result, React descendants rendered through a portal from elsewhere insideCombobox.Popupcould be treated as outside the Combobox and close it when interacted with. This was noticeable when rendering a nested Popover beside the list.This change attaches the dismissal handlers to
Combobox.Popup, matching Select’s behavior, while keeping list navigation handlers onCombobox.List. This ensures portalled controls do not accidentally handle Combobox navigation keys. Regression tests cover both the dismissal behavior and arrow-key handling, along with the equivalent behavior in Select.Here's the same example code from the ticket on top of a patched base-ui, which works: https://codesandbox.io/p/devbox/base-ui-combobox-portal-bug-forked-qvprr3
Fixes #5333.