Repository navigation
Open rendered code, diff and diagram blocks by clicking or arrowing in - #388
Conversation
|
Review: Changes needed Checked in a real browser (headless Chromium, desktop 1440x900 and phone 390x844 with touch, reduced motion, two-user and read-only sessions) plus a code read. Most of the design works well; one blocker and two smaller gaps. Works
Blocker
Should fix Minor
CI ( |
|
Thanks for the review. All five points are addressed in e185e74 and eb108f7. CI:
Also fixed: with a comment preview open on the same passage, Escape from a source also closed the comment preview and sent focus to its marker. The Escape that returns to the preview now stops there. |
|
Review: Looks good Re-verified at eb108f7 in a fresh build (headless Chromium, desktop). Fixed
Remaining nits, not blocking
|
|
Both follow-ups:
CI on 409a77a: |
658a58d to
c2d2b34
Compare
Clicking a preview opens its source with the caret where the click was (the clicked line and column for code, the matching patch line for a diff, the end for a diagram or formula). Code and diffs swap the coloured copy for the source instead of showing both. Escape returns to the preview and holds focus on it; Enter, Space or typing on a focused preview opens the source, and ArrowUp/ArrowDown move on. Arrowing from a neighbouring block enters a collapsed block instead of skipping it: the caret goes into code, and a diagram is held as a block. A source the caret opened closes again when the caret leaves; one opened with the toggle stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A press on a preview no longer lets the browser drop the caret into the hidden source. The selection follows the pointer inside the renderer's shadow roots, so code can be dragged over and copied without opening it. Copy from a preview is left to the browser. While the press lasts, the caret-follows-selection opening is suspended; the click decides. - Arrow keys find a folded block across callouts and list items, not only top-level siblings, measuring from the DOM selection so a key pressed right after a click starts from the click. - Escape that returns to a preview is not also taken by a comment preview. - The focus ring sits on the block's border, clear of the corner controls. - The syntax-contrast test checks the ring with expectFocusIndicator again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c4c4578 to
86cb5be
Compare
Why
Rendered code, diff and diagram blocks could not be entered to edit. Clicking the coloured code focused a non-editable preview: typing did nothing, Space scrolled the pane, and the source appeared as a second copy underneath. ArrowDown from the heading above skipped every collapsed block and landed in the next table. Clicking a diagram put a browser caret inside a Mermaid label, and typing went into the drawing's HTML. The only way in was the small
<>toggle.What changed
--duration-fast, off under reduced motion). A diagram keeps its drawing above the source, as in Quiet rendered block chrome and steady diagram previews #370.<>toggle stays open until you hide it.contenteditable=false.AGENTS.md's code-block rules still hold. The preview is still derived UI owned by one React tree, and no second editor is mounted. Every caret placement is a Lexical range selection inside the canonical code node. Keys aimed at a focused preview are handled before Lexical's own key handling, so they never act on a caret left somewhere else.
Screenshots
Clicking code. Before: the source appears as a second copy underneath, typing does nothing, and Space scrolls away.


After:
Arrowing down from the heading. Before: the caret skips the blocks, and "Q" lands in the document title.


After: into the code, into the diff, Escape back to the preview, onto the diagram, edit it, and out into the table.
Clicking a diagram. Before: "W" is typed into the "Commit" label.


After:
Verification
bun run fix,bun run ci,bun run types, andbun run buildpassed. Reviewed design hashes are current.🤖 Generated with Claude Code