feat(react): add the Select primitive#13
Open
ivanbanov wants to merge 2 commits into
Open
Conversation
Adds @dunky.dev/select (core state machine) and @dunky.dev/react-select (React binding). Anatomy: Select root with Trigger, Value, Listbox, Item, and ItemIndicator parts. A single-choice dropdown listbox following the WAI-ARIA select-only combobox pattern: focus stays on the trigger while aria-activedescendant tracks the highlighted option, and the machine owns navigation, typeahead, and selection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Adds the Select primitive as two packages:
@dunky.dev/select— the framework-free core: a state machine (built on@dunky.dev/state-machine) that owns value + open state, optionregistration, highlight navigation, typeahead, and selection.
@dunky.dev/react-select— the thin React binding that renders thecompound parts and wires DOM events into the machine.
A single-choice dropdown listbox following the WAI-ARIA select-only combobox
pattern. Value and open state are each controlled or uncontrolled; every
value, open, and highlight change is reported through
onValueChange/onOpenChange/onHighlightChange.Anatomy
Behavior
aria-activedescendantnames the highlighted option — the APG select-onlycombobox model (one tab stop, no focus jumps on open/close).
comboboxwitharia-haspopup="listbox",aria-expanded, andaria-controls; the popup is alistboxofoptionscarrying
aria-selected/aria-disabled.option, else the first enabled); Home/End open pinned to the first/last.
While open, arrows move the highlight across enabled options (wrapping when
loop), Enter/Space select and close, Escape/Tab/outside interaction closewithout selecting.
(1s reset) with case-insensitive prefix matching; a repeated character
cycles through options starting with it.
so the option list always mirrors what is rendered; disabled items are
skipped by navigation and typeahead.
Test plan
pnpm test:ci— 162 tests passingpnpm typecheckpnpm lintpnpm format:checkpnpm build🤖 Generated with Claude Code