Repository navigation
Draw the composer's Markdown preview in the sent message's faces - #1271
Merged
Merged
Conversation
The composer's preview (`composing/text-field.js`, #1234) took its constructs from the message renderer but wrote its own faces, and they disagreed with the message from birth: inline code at 0.9em with a 3px chip against the message's 82% and 4px, strong and headings at weight 650 against 700, a quote upright under a 3px `--border-2` rule against italic under a 2px `--rule` rule, a link underlined in full accent against 35%, and a code block as a tinted strip against a framed white block. The theme's element rules stop at the field's closed shadow root, so the faces those rules draw are now `:root` tokens in `theme.css` (`--code-inline-*`, `--quote-*`, `--pre-inset`, `--link-underline*`), which the `code`, `pre`, `blockquote` and `a` rules and the preview both read. Strong, emphasis and strikethrough are drawn as the `strong`, `em` and `del` elements, so the platform dresses them in the field as it does in the message; inline code is a `code` element. The panel's narrower insets for a quote and a code block are those tokens set on `.lf-thread-panel`, so a draft in the panel insets as the panel's messages do. Behaviour that moved: a draft's inline code, strong, headings, quotes, links and code blocks now read as the sent message does. Page elements compute exactly as before. `test_a_draft_wears_the_faces_its_sent_message_wears` compares each construct's computed face in the draft (read through DevTools, which reaches the closed root) with the same Markdown sent in the panel. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 27, 2026
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.
A draft in the composer now reads in the faces of the message it will send. The Markdown preview (
composing/text-field.js, #1234) took its constructs from the message renderer but wrote its own faces, which disagreed with the message from the start:--border-2rule, 8px inset--rulerule, 10px inset in the panel--code-bgstrip at 0.9em--pre-bgblock at--code-sizeThe theme's element rules stop at the field's closed shadow root, so the values they draw are now
:roottokens intheme.css(--code-inline-size/-pad/-r,--quote-rule/-style/-inset,--pre-inset,--link-underline,--link-underline-offset). Thecode,pre,blockquoteandarules and the preview read the same tokens, and custom properties inherit into the shadow root. Strong, emphasis and strikethrough are drawn asstrong,emanddelelements, so the browser's default styles apply to them in the field as in the message; inline code is acodeelement. The preview draws a code block line by line, so its frame is each line's sides, closed on the first and last lines.The panel's narrower insets were
.lf-msg-body preand.lf-msg-body blockquotepaddings inchrome.css. They are now the same tokens set on.lf-thread-panel, so a draft in the panel insets as the panel's messages do. This hunk sits at the message-body rules, away from the Threads-panel rules the unmerged Codex gallery tree edits.Page elements compute as before: on a served page, a quote, code block, inline code and link compute the values the old rules stated. The remaining difference is the container: the composer sets its words at 14px and a panel message at 13px, and a draft marks a heading by weight only.
Before (current main), a sent message above the same Markdown drafted in the Threads panel's composer:
After:
Test:
test_a_draft_wears_the_faces_its_sent_message_wears(tests/test_chrome_contracts.py) writes a Markdown comment to the log, opens it in the panel, drafts the same Markdown in the general composer, and compares each construct's computed face. It reads the draft through DevTools, which reaches the closed root. Setting the quote back to its old rule or inline code back to 0.9em fails it.🤖 Generated with Claude Code