fix(web): wire active-row a11y on search listbox#403
Merged
Conversation
Listbox row pass `selected=Signal::derive(|| false)` always — keyboard + AT users see no active option. Add `active_index` signal in `SearchUiState`, derive `selected` per row from flat in-display-order index, set `aria-activedescendant` on input, move index on Up/Down/Home/End. Reset on result/scope change. Browser test prove active row carry `aria-selected="true"`, others `false`, swap reactively, and cross-group flat-index walk pick right row under BTreeMap-grouped scope. Closes #344
This was referenced Apr 27, 2026
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.
Why
<ResultsList>pass every rowselected=Signal::derive(|| false). No roving tabindex, noaria-activedescendanton input. Keyboard user not see which row Enter target. Screen reader never see selected option in listbox. Spec say listbox MUST mark active option — this regress a11y baseline. Issue tag medium severity, [GEN-01].Fix
Track
active_index: ReadSignal<usize>inSearchUiState. Default 0. Reset to 0 whenever result set or scope change (Effect in surface) — stale index never outlive its data.Per-row
selectedderive from flat (in-display-order) index match:Signal::derive(move || active_index.get() == flat).flat = group_offset + intra_group_idx. Sameflat_ordered()helper used by input so input + listbox agree on what "row N" mean.Input keydown handle Up/Down/Home/End to move
active_index. Up/Down wrap (listbox-pattern default; match command palette behavior).aria-activedescendanton input point atid="search-row-{message_id}"of active row, omitted (Option::None) when results empty per WAI-ARIA.Enter still push to recents — not change in this PR. Enter-activate-active-row deserve separate change (touch surface callback wiring); track as follow-up.
Runner-up rejected: track active-row by
message_idinstead of flat index. Survive reorder better but cost extra lookup on every keystroke + complicate Home/End semantic. Flat index simpler, reset-on-change keep stale-pointer risk bounded.Verify
cargo clippy --workspace --all-targets -- -D warnings— clean.cargo fmt --check— clean.cargo check -p willow-web --target wasm32-unknown-unknown— clean.cargo test -p willow-web --lib— 68 pass.crates/web/tests/browser.rs(phase_2e_search_active_rowmod) — three test:aria-selected="true", othersfalse;active_indexswap selection reactively;AllGrovesAndLettersscope (regression guard for "indexes raw vec, not display order" bug).wasm-pack/ Firefox / geckodriver not present in this env — browser tests not run locally. Compile-time verify viaclippy --all-targets(cover the wasm test target).Closes #344
Generated by Claude Code