Skip to content

fix(web): Enter activates highlighted search row#433

Merged
intendednull merged 1 commit into
claude/adoring-euler-DvNnkfrom
auto-fix/issue-406-search-enter-activate
Apr 27, 2026
Merged

fix(web): Enter activates highlighted search row#433
intendednull merged 1 commit into
claude/adoring-euler-DvNnkfrom
auto-fix/issue-406-search-enter-activate

Conversation

@intendednull
Copy link
Copy Markdown
Owner

Bug

Search a11y land active_index + aria-activedescendant in #344. Enter still route to "push to recents" not activate highlighted row. ArrowDown move highlight, Enter ignore it.

Fix

Wire Enter in input.rs keydown to invoke on_select for row at active_index in flat in-display order. No row (zero results) → fall through existing on_submit recents-push path so empty-hit queries still remembered.

SearchInput get new on_select: Callback<SearchResult> prop. surface.rs pass on_select_result (same callback row click use).

Test

Browser test (crates/web/tests/browser.rs):

  • Seed three rows + active_index=1, dispatch Enter on input. Assert on_select fire with m-1 exact, on_submit not fire.
  • Zero-results fallback: dispatch Enter, on_select silent, on_submit get raw query.

TDD red-green: prop missing → compile fail (RED), add prop + wire → tests pass (GREEN).

Refs #406


Generated by Claude Code

Search a11y land active_index + aria-activedescendant in #344,
but Enter still route to recents-push. Wire Enter on input
keydown to invoke on_select for row at active_index in flat
in-display order. No active row (zero results) fall through to
existing recents-push path so empty-hit queries still get
remembered.

Browser test seed three rows, set active_index=1, dispatch
Enter, assert on_select fire with m-1 not on_submit. Second
test pin zero-results fallback.

Refs #406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants