Conversation
…ect index matching
…h results - Add section-expansion.ts module with event system for triggering expansion - Expand reasoning blocks, tool outputs, sidebar accordions, folder nodes on navigation - Add event listeners to ReasoningCard, ToolCall, InstanceShell2, FolderTreeNode - Integrate expansion logic into scrollToCurrentMatch() in search-store.ts - Wait for DOM updates after expansion before scrolling Components now respond to search navigation by auto-expanding collapsed sections containing search matches. Closes: Search expansion implementation
- Remove console.warn() calls that were showing 'Match element not found' - These warnings are expected when elements haven't rendered yet - Expansion still works via metadata-based triggers Silent search navigation
- Replace DOM element lookups with message anchor positions - Finds anchor closest to viewport center - Then finds first match in that message - Works even before DOM highlighting is applied This should fix the issue where search always went to top
- Add 400ms debounce timer to auto-search after typing stops - Clear old search results immediately when query changes - This fixes the issue where old highlights remained when user selects-all and types new text - Use reactive state management (clearing matches) instead of DOM manipulation - Add timer cleanup in closeSearch and executeSearchOnEnter to prevent memory leaks - Update search panel to pass store parameter to setQueryInput Replaces the previous approach of manually clearing DOM highlights which didn't work due to SolidJS reactive re-rendering.
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.
PR: Chat Search Navigation & Highlights
Overview
This PR adds chat search functionality with keyboard navigation, match highlighting, and auto-expansion of collapsed sections.
What's Implemented
packages/ui/src/components/search-panel.tsx): Floating UI with query input, navigation buttons, match counter, and options (case-sensitive, whole-word, tool outputs, reasoning blocks)packages/ui/src/stores/search-store.ts): Centralized state for query, matches,currentIndex, navigation (navigateNext/navigatePrevious), and scroll-to-match logicSearchHighlightedTextcomponent with reliablesearch-match--currentoutlinepackages/ui/src/lib/section-expansion.ts): Expands reasoning blocks, tool calls, folder nodes, sidebar accordions on navigationCmd+F/Ctrl+Fto open,Escto close,Enter/Shift+Enterto navigate, arrow keys for navigationcurrentIndexdefaults to match nearest visible viewportCommits (7 ahead of
origin/dev)f3bba7e— feat(ui): add chat search panel + highlights82f732d— fix(ui): resolve search highlight bug in Markdown component using direct index matchingf3c7fc3— feat(search): auto-expand collapsed sections when navigating to search resultsa1696c8— fix(search): remove console warnings for missing match elementsd3db2eb— fix(search): use message anchors to find closest match78ef347— feat(search): add debounced auto-search for better UX0b528a7— fix(search): improve highlight reliability with DOM retry logicKnown Limitation
Current match outline (
search-match--current) may not appear in assistant panelSymptoms
Markdowncomponent)Root Cause
Markdown component uses DOM-based post-render highlighting:
<mark class="search-match">via TreeWalker → always worksdata-search-start/endordata-search-occurrence→ can fail due to timing/race conditionsNavigation flow:
navigateNext()/navigatePrevious()updatescurrentIndexin storescrollToCurrentMatch()expands sections and scrolls (may fall back to message anchor if marks not yet found)Markdown.applySearchHighlights()tries to addsearch-match--currentto the specific mark via selectorLatest commit (
0b528a7) added retry logic to mitigate but does not fully eliminate the issue for:globalIndexOffsetcomputation can drift from store'sstartIndex/endIndexWhy Accept as MVP
Plain-text user messages continue to work reliably (
SearchHighlightedTextcomputesisCurrentreactively and sets class during render).Testing Notes
npm run typecheckpasses before merge