Skip to content

Finish the Dropdown selection the keyboard started - #311

Merged
woksin merged 1 commit into
mainfrom
fix/filtered-dropdown-commits-with-keyboard
Sep 22, 2026
Merged

woksin merged 1 commit into
mainfrom
fix/filtered-dropdown-commits-with-keyboard

Conversation

@woksin

@woksin woksin commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

A filtered Dropdown could narrow to the option you wanted and make it keyboard-active with ArrowDown, but Enter did not finish the job: the filter text stayed as typed, the list stayed open, and aria-expanded stayed true. The value was reported, but the selection never landed. Keyboard-only users could not pick an option at all.

Closing the list and settling the filter text was left to the value the application sends back in. An application that does not feed the emitted value straight back, or that answers with a value none of the options carry, never got either — and had no way to do it itself, because the Dropdown exposes neither open state nor input value. The Dropdown now completes the selection it started.

No CSS changed and no markup changed. An application that already feeds the value straight back renders identical DOM before and after. Where the value is not fed back, the Dropdown now renders the selection it committed — filter text, trigger label, data-selected, and the clear action when showClear is set — instead of the stale filter text it used to leave behind. That is the fix, and it is a visible difference for anyone who was living with the defect.

Fixed

A filtered Dropdown narrowed correctly and made an option keyboard-active
with ArrowDown, but Enter left the filter text unchanged, the listbox
mounted and aria-expanded true. The value was reported through onChange;
nothing else about the commit happened.

React Aria treats a filtered single selection as finished only when the key
the ComboBox was handed changes, and deliberately stands down otherwise so
the application can drive the closing. That key was derived from the `value`
prop alone, so an application that does not feed the emitted value straight
back - or that answers with a value none of the options carry - never got
the overlay closed or the filter text settled, and had no handle on either:
the Dropdown exposes no open state and no input value.

The Dropdown now remembers the option the user committed, so the commit
completes on its own, and closes the filtered overlay itself instead of
waiting for a value that may never resolve. An incoming `value` still
decides what is selected and still drops the remembered option the moment
the consumer answers, so a round-tripping application renders exactly as
before. The same memory gives the unfiltered trigger its selected label
instead of leaving the placeholder standing.

Covered by jsdom specs for ArrowDown, ArrowUp, Escape and the unfiltered
path across both bindings, and by a browser story that types, arrows and
commits with no value bound at all.

(#239)
@woksin woksin added the patch label Sep 22, 2026
@woksin
woksin merged commit 40481f0 into main Sep 22, 2026
50 of 51 checks passed
@woksin
woksin deleted the fix/filtered-dropdown-commits-with-keyboard branch September 22, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant