Fix Tab selection in Combobox and TagPicker - #36795
Open
Bernardo Sunderhus (bsunderhus) wants to merge 8 commits into
Open
Bernardo Sunderhus (bsunderhus) wants to merge 8 commits into
Bernardo Sunderhus (bsunderhus) wants to merge 8 commits into
Conversation
Bernardo Sunderhus (bsunderhus)
requested review from
a team and
Dmytro Kirpa (dmytrokirpa)
as code owners
September 24, 2026 18:58
|
Pull request demo site: URL |
Bernardo Sunderhus (bsunderhus)
force-pushed
the
fix/combobox-tab-selection
branch
from
September 24, 2026 19:10
b1b42f7 to
6f38f93
Compare
📊 Bundle size reportUnchanged fixtures
|
Bernardo Sunderhus (bsunderhus)
force-pushed
the
fix/combobox-tab-selection
branch
from
September 24, 2026 19:47
6f38f93 to
5898321
Compare
Bernardo Sunderhus (bsunderhus)
force-pushed
the
fix/combobox-tab-selection
branch
from
September 24, 2026 20:02
5898321 to
f5780bd
Compare
Bernardo Sunderhus (bsunderhus)
force-pushed
the
fix/combobox-tab-selection
branch
from
September 25, 2026 10:52
f8804c6 to
91514d0
Compare
Handle duplicate Tabster movefocus events, support shadow DOM targets, limit listeners to relevant states, and cover the real root-exit focus path.
Keep multiselect clear behavior unchanged and centralize tag dismissal through the existing selectOption context action for styled and headless TagPicker groups.
Add the missing Beachball metadata for the headless TagPicker dismissal fix.
Bernardo Sunderhus (bsunderhus)
requested a review
from Dmytro Kirpa (dmytrokirpa)
September 29, 2026 13:18
This branch has not been deployed
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.

Problem
Combobox-style components keep focus on the trigger and represent the highlighted option with
aria-activedescendant. In single-select mode, Tab or Shift+Tab should select that option before moving focus. In multiselect mode, Tab should only close the popup.The existing React
onKeyDownpath works during ordinary browser navigation but can be skipped when Tabster manages focus. Tabster handles keydown during window capture and may stop propagation before React receives it. TagPicker also had no real single-select mode: controlled state could contain one item, but its internal trigger, listbox, option, and dismissal semantics remained multiselect.Fixes #31365.
Approaches considered
ignoreKeydown: restores React keydown by disabling Tabster focus handling, breaking focus-navigation edge cases.setOpen: incorrectly couples every close operation with selection.onOptionSelect2: type-safe but introduces a versioned public callback, deprecation, dual plumbing, and future cleanup for a private integration issue.Solution
The implementation uses two complementary paths:
onKeyDown.tabster:movefocus. Its original nativeKeyboardEventis wrapped by a private React-compatible adapter and passed through the existing selection path. Tabster still performs focus movement.The adapter preserves the callback behavior consumers can observe:
nativeEvent, callback-scopedcurrentTarget, default prevention, propagation state, andpersist(). It remains private and contract-tested. Combobox and TagPicker keep separate private implementations so no package-internal helper is exported.This preserves the existing
onOptionSelectAPI while covering both managed and ordinary focus topologies.TagPicker
TagPicker now supports:
selectionModeis optional and defaults tomultiselect. It drives selection state, input/button triggers, listbox and option semantics, and tag dismissal. Single mode replaces the current option, keeps input text independent from the selected tag, and clears selection when the tag is dismissed.selectionModealso remains optional on public state/context types to avoid breaking custom state or context objects; internal context construction defaults it tomultiselect.Validation