q2-preview: keep task-list checkbox and text on one line (bd-qif9l4cx) - #673
Merged
Conversation
Diagnosis + fix design for the checkbox-on-its-own-line bug in the q2-preview format (CommentBlock's block wrapper lands inside the task <label>). Decisions recorded after review. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RhBKwo1GN35y7fqzL364wB
A `- [x] item` in the q2-preview format rendered its checkbox alone on
one line with the item text (and the bullet) on the next. TaskItemBody
built the <label> around <Node node={Plain}>, and the registry's Block
entry — CommentBlock since Comments v1 (#441), which landed after the
task-list work (#407) — wraps every commentable block in a positioned
<div>. That block box inside the inline <label>, after the <input>,
forced the text onto its own line. The attribution wrapper and the
measured edit surface are the same class of hazard.
Move the <label> into the head block renderer: BulletList/OrderedList
provide {checked, onToggle} through a TaskItemContext around the item's
head block only, and Plain/Para strip the ballot-box marker and render
the writer's <label><input type="checkbox"/>…</label> themselves. Every
block-level wrapper now stays an ancestor of the label. As in the native
writer, tight items render li > label and loose items li > p > label —
loose (Para-leading) task items previously showed the raw glyph and had
no checkbox at all (bd-tvtknbhx polish item 2).
Tests (red first):
- preview-renderer task-list integration tests: the label must hold no
block element; new fixtures for the reporter's nested/mixed list, a
loose list and an ordered list, with toggle coverage for each. Five
failed before the fix, 10/10 after.
- hub-client e2e spec q2-preview-task-list.spec.ts: real hub + q2-preview
iframe; asserts the text's first client rect sits on the checkbox's
line. Passes; fails on the pre-fix renderer.
Verified end to end through `q2 preview` after rebuilding the SPA (label
height 51px -> 25.5px on the reporter's document; --allow-edit toggle
writes [x] back to disk) and `cargo xtask verify --skip-rust-tests`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhBKwo1GN35y7fqzL364wB
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RhBKwo1GN35y7fqzL364wB
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RhBKwo1GN35y7fqzL364wB
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
A
- [x] itemin theq2-previewformat rendered its checkbox alone on one line with the item text (and the bullet) on the next — seen live on quarto-hub.com on 2026-09-10. Reproduced locally inq2 preview, which sharesPreviewRootwith hub-client; every task item was affected, not just nested or mixed lists.Root cause.
TaskItemBodybuilt the<label>around<Node node={Plain}>. The registry'sBlockentry has beenCommentBlocksince Comments v1 (#441, which landed nine days after the task-list work in #407); it wraps every commentable block in a positioned<div>. That block box inside the inline<label>, after the<input>, forced the text onto its own line. The attribution wrapper and the measured edit surface are the same class of hazard, so this fix does not depend on bd-q2wqj24c (removing the CommentBlock wrapper).Fix. Move the
<label>into the head block renderer.BulletList/OrderedListprovide{checked, onToggle}through aTaskItemContextaround the item's head block only;Plain/Parastrip the ballot-box marker and render the writer's<label><input type="checkbox"/>…</label>themselves, so every block-level wrapper stays an ancestor of the label. As in the native HTML writer, tight items renderli > labeland loose itemsli > p > label— loose (Para-leading) task items previously showed the raw glyph and had no checkbox at all (bd-tvtknbhx polish item 2).Plan with the full diagnosis and evidence:
claude-notes/plans/2026-09-10-q2-preview-task-checkbox-layout.md.Tests (written red-first)
ts-packages/preview-renderertask-list integration tests: the label must hold no block element; new fixtures for the reporter's nested/mixed list, a loose list and an ordered list, with toggle coverage for each. 5 failed before the fix, 10/10 after.hub-client/e2e/q2-preview-task-list.spec.ts(real hub + q2-preview iframe): asserts the text's first client rect sits on the checkbox's line. Passes; fails on the pre-fix renderer (toHaveCount(5)received 3).End-to-end verification
q2 previewon the reported document aftercargo xtask build-q2-preview-spa && cargo build --bin q2: label height 51px → 25.5px, DOM now<li><div …><label><input …>text</label></div></li>; screenshot inspected.q2 preview --allow-edit: clicking a checkbox still writes[x]/[ ]back to disk, including for loose items.cargo xtask verify --skip-rust-testsgreen (no Rust source changed).Closes bd-qif9l4cx. Related: bd-q2wqj24c, bd-tvtknbhx.
🤖 Generated with Claude Code
https://claude.ai/code/session_01RhBKwo1GN35y7fqzL364wB