Repository navigation
fix(conversation): keep map and marker focus, skip empty thread input - #145
pratikbuilds wants to merge 2 commits into
Conversation
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Request changes
Summary
ConversationMap, ConversationEarlier, and ConversationThread fixes for #142 (items 5, 6, 7, and 19) pass bun run check, bun run dep-guard, and Playwright e2e/conversation-map.spec.ts. One should-fix in ConversationMap where hiding the map while a tick is previewed leaves preview state set and reopens a stale tooltip when the map returns.
Blockers
None.
Should-fix
src/ui/conversation-map.tsx:163(reviewer,designer) — Whenhidden(turns.length < 2) becomestruewhile a tick is focused (or pointer-previewed),<nav>unmounts without firingonBluroronPointerLeave. The layout effect callssetFocusedId(null)and moves focus toscrollContainer(), but never clearspreview. As a result,previewing(preview !== nullat line 178) staystrue(keeping the documentEscapelistener attached while hidden), and when a second turn arrives (turns.length >= 2) while focus remains on the conversation log,previewedstill matches the retained turn ID and immediately renders<div role="tooltip" data-slot="conversation-map-preview">. CallsetPreview(null)before(stop ?? scrollContainer())?.focus({ preventScroll: true }), and clearpreviewwhenhiddenor!turnIds.includes(preview.id).
Informational
src/ui/conversation-thread.tsx:120(designer) —children === undefined || children === null || typeof children === "boolean"catches{show && <PromptInput />}whenshowisfalse, but multiple conditional siblings ({a && <X />}{b && <Y />}->[false, false]) or an empty fragment still render<div data-slot="conversation-thread-input">.src/ui/conversation-map.tsx:163,src/ui/conversation-earlier.tsx:98(designer) — Focus recovery runs on prop transitions (turns.length < 2andhasEarlier === false); if a consumer conditionally unmounts the component directly while focused, only effect cleanups run (compareScrollToLatestinsrc/ui/conversation.tsx:1031).
Addresses findings 5, 6, 7 and 19 of corbitsdev#142. - 5: ConversationMap's Arrow/Home/End scroll only the rail to the next tick and focus it with preventScroll, so a clipped tick no longer scrolls the page or another ancestor. - 6: when the map hides with the focused tick's turn still present, focus now moves to the conversation log instead of falling to the body. The map also drops its preview when it hides or the previewed turn leaves, so the tooltip cannot come back on its own with a later turn. - 7: ConversationEarlier clears its retry focus flag when the marker unmounts, so a later stall or load cannot pull focus to it. - 19: ConversationThread leaves out the input slot for boolean children, as `{show && <PromptInput />}` passes.
96ee7ea to
4ec55aa
Compare
Hiding the rail unmounts a previewed tick without pointer leave or blur, so the tooltip and its Escape listener stayed. Clear that preview before focus returns to the log, and when the previewed turn is no longer in the map.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Approving. Hiding the map clears the tick preview in the same layout effect that moves focus, so the tooltip and the Escape listener do not come back. Map and marker focus, and the empty thread-input skip, stay as they are.
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. Notes:
|
Nothing triage asked to change still fails, so this request no longer stands.
Summary
Focus fixes for the conversation map and the earlier-messages marker, plus a thread slot fix (findings 5, 6, 7 and 19).
preventScroll, so a clipped tick no longer scrolls the page or another ancestor.turns, so the tooltip cannot come back on its own when a second turn arrives.{show && <PromptInput />}passes, no longer render an empty input slot.Verification
bun run checkbun run test:e2e, with the new rail-scroll and hide-with-focus cases ine2e/conversation-map.spec.tsconversation-earliertest keepsstalledtrue while the history ends and returns, and fails withouthasEarlierin the effect's deps.Closes #142