Repository navigation
Conversation
Add scoped transcript search with highlighted matches, result navigation, and safe Escape handling for main and side chats. Include localization, regression tests, and the rebuilt UI bundle. Refs alphaXiv#700
[Medium impact] Adds in-chat search UI and text-matching logic. Fix hidden and clipped search results before merging. FindingsFix with agent prompt### Issue 1
ui/src/chatSearch.ts:45-48
`transcriptSearchRanges` includes text inside closed `<details>` elements. Resolved plans and questions keep their bodies mounted without `hidden`, `inert`, or `aria-hidden`, so invisible text contributes matches. Selecting those matches does not reveal them because search never opens the disclosure. Skip non-summary content inside closed `<details>` elements, and include it after expansion.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
### Issue 2
ui/src/components/ChatSearch.tsx:79-85
Match navigation scrolls the chat vertically but only scrolls nested containers horizontally. Shell output and expanded error details use `TOOL_OUTPUT_CLASS_NAME`, which limits their height and enables vertical scrolling. A match below that container's visible area stays clipped even after search selects it. Scroll nested vertical containers to reveal the match before positioning it in the chat.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds in-chat search for main and side chats, with keyboard shortcuts, highlighted matches, wrapping navigation, and translated controls.
|
| acceptNode(node) { | ||
| if (node instanceof Element) { | ||
| if (node.matches(EXCLUDED)) return NodeFilter.FILTER_REJECT; | ||
| return node.tagName === "BR" ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; |
There was a problem hiding this comment.
transcriptSearchRanges includes text inside closed <details> elements. Resolved plans and questions keep their bodies mounted without hidden, inert, or aria-hidden, so invisible text contributes matches. Selecting those matches does not reveal them because search never opens the disclosure. Skip non-summary content inside closed <details> elements, and include it after expansion.
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/chatSearch.ts
Line: 45-48
Comment:
**Search selects hidden text**
`transcriptSearchRanges` includes text inside closed `<details>` elements. Resolved plans and questions keep their bodies mounted without `hidden`, `inert`, or `aria-hidden`, so invisible text contributes matches. Selecting those matches does not reveal them because search never opens the disclosure. Skip non-summary content inside closed `<details>` elements, and include it after expansion.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| scroll.scrollTop += rect.top - viewport.top - (scroll.clientHeight - rect.height) / 2; | ||
| // Code blocks can scroll horizontally without moving the chat pane. | ||
| for (let parent = range.startContainer.parentElement; parent && parent !== scroll; parent = parent.parentElement) { | ||
| if (parent.scrollWidth <= parent.clientWidth || !/(auto|scroll)/.test(getComputedStyle(parent).overflowX)) continue; | ||
| const match = range.getBoundingClientRect(); | ||
| const bounds = parent.getBoundingClientRect(); | ||
| parent.scrollLeft += match.left - bounds.left - (parent.clientWidth - match.width) / 2; |
There was a problem hiding this comment.
Match navigation scrolls the chat vertically but only scrolls nested containers horizontally. Shell output and expanded error details use TOOL_OUTPUT_CLASS_NAME, which limits their height and enables vertical scrolling. A match below that container's visible area stays clipped even after search selects it. Scroll nested vertical containers to reveal the match before positioning it in the chat.
Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/components/ChatSearch.tsx
Line: 79-85
Comment:
**Output matches stay clipped**
Match navigation scrolls the chat vertically but only scrolls nested containers horizontally. Shell output and expanded error details use `TOOL_OUTPUT_CLASS_NAME`, which limits their height and enables vertical scrolling. A match below that container's visible area stays clipped even after search selects it. Scroll nested vertical containers to reveal the match before positioning it in the chat.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Exclude hidden content of closed details while retaining the visible first summary. Reveal matches in nested vertical and horizontal scroll containers before positioning the chat viewport. Add jsdom regression tests for disclosure visibility, nested scrolling, and inline matching; rebuild the embedded UI bundle.
Closes #700
Summary
ui/distbundle.Test plan
node --test --experimental-strip-types ui/tests/*.test.mjs— 324 tests passed.pnpm buildinui/— localization validation, TypeScript checking, and production bundle passed.pnpm install --frozen-lockfile --offline --ignore-scriptsinui/passed.node ui/scripts/check-styles.mjsandcargo fmt --all --checkpassed.