Repository navigation
Render draft Markdown with stable local editing controls - #2064
Conversation
Separate formatted reading from source state, move editing commands into the draft footer, and keep visual shortcut hints outside native buttons. Share Markdown dialect and source positioning across delivery, passages, editing, and revision comparison; align parser-normalized blocks without a second normalization grammar.
An empty inline token still has one source boundary. Retain it so later table cells and paragraphs keep exact caret positions. Cover empty headers and body cells in the existing rendered-caret test. Isolate the body-record registry fixture from the separate Markdown content contract.
leaf-agent
left a comment
There was a problem hiding this comment.
The Markdown preparation removes each draft’s source <pre> with pre.replaceWith(body), and lf-draft also drops it during connection. A later live revision still reads that source through dataBody(element), which requires the direct <pre>. The focused test_gallery_automatic_revision_keeps_the_empty_reply_focused[in-place] reproduces repeated Cannot read properties of null (reading 'textContent') errors and never reaches the new revision. The source needs to remain available through revision installation and semantic capture.
Rendered Markdown also changes the anchor’s block from the draft’s authored seat to a generated paragraph. anchor-controls.js seats a quote reaction at annotationAt(segment.node), which now selects that paragraph; the focused test_a_reaction_inside_a_widget_keeps_its_authored_seat[draft-ops] finds no reaction at the draft’s margin seat. Keep annotations for text inside a draft attached to the authored widget boundary when formatting introduces descendant blocks.
Preload parser and widget dependencies without consuming inert source markup. Paint copied arrivals only after their typed state and descriptors are captured, so automatic revisions preserve exact draft source. Seat annotations on the declared Markdown host while keeping paragraph reading grain. Retain the closing gesture for deferred focus return so a newer pointer selection wins. Cover source preparation, annotation seats, and real selection before a held Close callback; await the Close focus handoff before programmatic selection in the phone fixture.
PR #2064 changed draft presentation from raw source text to rendered Markdown and made Mod+Enter the draft Save shortcut. Four complete-suite browser checks still read the old text node, compared a detached widget's entire generated HTML, or pressed Enter to save. This change tests the exact source and visible passage while retaining the original replay, reconnect, and response-bar behavior checks. The four affected browser cases failed before this change on current `main` and pass after it; pre-commit passes. This repairs another subset of [failed main run 37819031263](https://github.com/max-sixty/leaf/actions/runs/37819031263). Co-authored-by: leaf-agent <[email protected]>
PR #2064 moved draft Edit into the widget, so a page containing only a draft no longer has a margin action row. The reaction-furniture check still tried to open that retired row. It now uses a suggestion's live margin action and continues to verify selected and unselected reaction paint in both color schemes. Both affected browser cases failed before this change on current `main` and now pass; pre-commit passes. This repairs the reaction subset of [failed main run 37819031263](https://github.com/max-sixty/leaf/actions/runs/37819031263). Co-authored-by: leaf-agent <[email protected]>
PR #2064 intentionally removed the visible badge inside the Done button and began rendering option words through Markdown. The complete main run's options checks still expected that badge and the original raw text node. These checks now require Done's working `4` keyboard shortcut, the visible option words, and stable group, option, title, and control elements through choice, refusal, and reconnection. The three affected browser cases failed before this change on current `main` and now pass; pre-commit passes. This repairs the options subset of [failed main run 37819031263](https://github.com/max-sixty/leaf/actions/runs/37819031263). --------- Co-authored-by: leaf-agent <[email protected]>
PR #2064 moved draft editing out of the annotation rail. Four complete-suite margin checks still required a draft row that no longer exists. The gallery lifecycle and primary-action journeys now keep their live suggestion and workflow assertions; pointer ownership and highlight refresh use existing margin actions. Draft editing is checked through its local controls in PR #2102. All four affected browser cases failed before this change and pass after it on current `main`; pre-commit passes. This repairs the retired-draft-row subset of [failed main run 37819031263](https://github.com/max-sixty/leaf/actions/runs/37819031263). Co-authored-by: leaf-agent <[email protected]>
) PR #2064 moved draft editing actions from the annotation rail into each draft. The complete main run still checks the old rail controls; Draw mode also claims a press on the new in-widget Edit button as ink. This change lets widget-offered controls keep their pointer gestures in Draw mode and updates the affected browser journeys to use the local draft actions and current keyboard labels. The three-width draft and Page Map journey, the rail Ask/save/undo journey, Draw mode editing, Page Map routing, and numbered Ask navigation now pass (7 browser cases). All 254 runtime tests and pre-commit pass. The affected browser checks failed before this change on current `main`. This addresses the draft-control subset of [failed main run 37819031263](https://github.com/max-sixty/leaf/actions/runs/37819031263). The run also contains other failures that need separate repairs. --------- Co-authored-by: leaf-agent <[email protected]>
A multiple-choice Question showed digits on its options and its add field but none on Done. Done's `4` still worked and stayed in `aria-keyshortcuts`, but a user reading the keys saw no way to finish the Question. #2064 had banned shortcut badges inside native buttons and dropped Done's badge instead of moving it. The ban guarded a real failure: an in-flow badge filled on focus resized its button between pointer down and up, and the click was lost. The same commit made every lent badge an absolutely positioned `lf-binding-seat`, which already prevents that for any holder, so the button-ancestry ban was a second, coarser guard for the same guarantee. This removes the ban and its two tests; the draft test that holds button edges still under a raw press stays. Done's badge is back inside its button, as an option's is inside the option, so a press on it is a press on Done. It sits in the column the other digits use: inline-end on cards, inline-start on rows. Tests that asserted a badge-less Done now assert its digit, that showing it moves no button edge, and that clicking it presses Done. The `test` job's one failure, `test_chrome_contracts.py::test_a_traffic_wait_stops_when_repaints_outlive_its_deadline`, is not from this change: it fails the same way on the unrelated `reduce-suite-cost` and `fix/ci-38159211604-sample-release` runs, and this change touches neither that test nor the traffic helper it exercises. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Drafts previously showed Markdown source as plain text and placed editing actions among margin annotations. They now render formatted Markdown with a local Edit/Save/Cancel/Close footer; hiding annotations leaves editing available. Save preserves exact source, Cancel discards unsent edits, and Close keeps them. Permanent buttons remain, while the current-page marker is plain text.
The shared renderer now uses Markdown-it with the same dialect as Python, replacing Marked. Declared block Markdown is delivered formatted for first paint, while projection, editing and revision comparison retain the exact source. Revision preparation loads dependencies without formatting source; copied arrivals are painted after typed semantic capture. Annotations retain the authored widget as their margin seat. Parser token spans and the shared text aligner carry rendered carets back to source, including tab-expanded list continuations and empty table cells.
Shortcut badges are excluded from native buttons through rendered ancestry, including nested slots. External hint seats stay out of flow; button labels and hit targets no longer change when focus projects shortcuts. Deferred Close focus yields to newer user gestures through the shared intent owner. The keyboard bar and accessible shortcuts remain available. Key implementation owners are
runtime/markdown.js,widgets/lf-draft.js,keyboard/command-hints.js, and Python passage/delivery projection.Validation: desktop and touch editing journeys, raw clicks at both button edges, a fresh user saving/canceling/keeping drafts, live revisions, frozen-thread undo and exact-source delivery tests, independent slot/caret/gesture regressions, 254 runtime tests, 83 browser-build tests, and pre-commit. The shared parser adds approximately 110 KB at presentation so live saved Markdown can render in the same turn.