Skip to content

Add in-room search match stepping with a k-of-N counter, highlight, and keyboard navigation#34008

Open
hayaksi1 wants to merge 1 commit into
element-hq:developfrom
hayaksi1:pr/search-stepping
Open

Add in-room search match stepping with a k-of-N counter, highlight, and keyboard navigation#34008
hayaksi1 wants to merge 1 commit into
element-hq:developfrom
hayaksi1:pr/search-stepping

Conversation

@hayaksi1

Copy link
Copy Markdown

Design-gated. This implements in-room search match stepping, which is part of the
match-presentation question under discussion in #21640 (X-Needs-Design). Opening it so the
behaviour and code are concrete to look at — happy to align the UX with whatever the design
discussion lands on before this merges. It also introduces the reusable search-session
infrastructure (SearchSessionStore + the shared SearchMatchNavigation component) that the
rest of the in-room search work builds on; those primitives are first consumed here.

Problem

In-room search shows a results list, but there is no way to step through the matches in place:
you can't see a match highlighted in the live timeline, can't move to the next/previous match, and
have no sense of "match k of N". Finding the right hit means scanning the results list and clicking
each one.

Fix

Add in-room match stepping driven by a small SearchSessionStore (the search cursor) and a shared
SearchMatchNavigation "k of N" control:

  • Stepping: up/down arrows (and Enter / Shift+Enter) move to the next/older or previous/newer
    match, scrolling the live timeline to it and focusing the matched tile.
  • Order: matches are sorted newest-first client-side so "next/previous" stays a consistent
    "older/newer" regardless of the backend's raw ordering; ties keep backend order (stable sort),
    undated matches sink last, and matches missing an event/room id are skipped (can't be jumped to).
  • Highlight: the focused tile gets a distinct "active match" band (bubble and modern layouts),
    separate from hover/selected and from the mention/keyword highlight, with the search term
    highlighted in its body.
  • k-of-N + back-to-results: the search aux panel shows the stepper and a "back to results"
    affordance while a match is focused, keeping the search session alive. The stepper's "loaded"
    denominator is disambiguated from the backend's "N results found" estimate.
  • Out-of-window / encrypted / remount edge cases are handled so the focused match survives a
    re-search and the session isn't torn down mid-jump.

Tests

  • SearchSessionStore-test: cursor lifecycle, stepping/wrap, durable focused-match guard, snapshot
    fields (matches/previews/order/scope).
  • RoomSearchNavigationViewModel-test: k-of-N derivation, step actions, wrap-around.
  • SearchMatchNavigation.test (shared-components): renders the counter + arrows, disabled/empty
    states.
  • MessagePanel / TimelinePanel / EventTile: focused-match highlight plumbing.

Relates to #21640

Checklist

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

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant