Skip to content

feat(composer): style inline markdown while typing, behind a setting - #15031

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:feat/composer-inline-markdown-render
Oct 7, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:feat/composer-inline-markdown-render

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A user who wants it can see bold, italic, strikethrough and inline code in the composer while typing, and every other user keeps the composer they have today.

The composer shows markdown as raw characters. **bold** and *italic* look like plain text until the message is sent, so it is hard to tell whether a marker is closed or which words it covers. #14736 added composerInlineMarkdown.ts, a small parser that reads those spans from the draft and follows the CommonMark emphasis rules for common cases (***both***, 2*3*4, snake_case_name, an unmatched **). Nothing drew them yet.

Why it matters

A marker left open, or a span that covers the wrong words, shows up before the send, not after. The composer parser is not the transcript's renderer, so a rare edge case can style differently from the sent bubble; the sent text is the same either way.

Not a goal

  • Hiding the markers. They stay visible and dimmed, so the text you edit is the text you send.
  • Changing the default composer. lexicalComposer stays off at every ChatInput call site; only this setting turns it on, per user.
  • Block markdown (headings, lists, quotes) or links.

What changed (motivation → approach → change)

Piece What it does
website/src/components/InlineMarkdownPlugin.tsx A Lexical text-node transform. For each edited paragraph it reads spans from parseInlineMarkdown and sets Lexical format bits (bold, italic, strikethrough, code) on the covered text and the theme's --muted colour on the markers, which keeps them readable in light themes (a fixed opacity fell below 4.5:1 there). The editor stays in plain-text mode, so the stored value is unchanged. It skips paste chips and mentions (only plain text nodes in normal mode take part), skips text while an IME is composing, keeps the caret offset across the split. One keystroke parses the edited run once: the transforms Lexical runs for each node a restyle touched reuse the last parse, keyed on the run's text. Turning it on or off restyles the whole draft in a history-merged update, so the toggle adds no undo step; off clears the formats.
website/src/components/LexicalComposerInput.tsx Thin hook-up: an inlineMarkdown prop, the plugin, and the theme classes.
website/src/components/ChatInput.tsx Reads the setting through useComposerInlineMarkdown. A textarea cannot draw styled text, so lexicalComposer is now lexicalComposerProp || inlineMarkdown: the setting moves that user onto the Lexical composer, and off leaves the textarea path untouched. The draft carries over when the setting is toggled live. The composer is controlled, so every pushed value (an Optimize result, ↑/↓ recall) clears Lexical's own undo history; the Lexical composer's UNDO/REDO commands therefore walk ChatInput's existing snapshot history (stepUndoHistory in chat-input/draftHistory.ts), the same one the textarea's Ctrl/Cmd+Z uses, through onHistoryStep on LexicalComposerInput. The textarea's other chords are passed through too: onOptimizeChord binds Cmd/Ctrl+Shift+Enter to Optimize when the host offers it, and onSend(alternate) carries the Cmd/Ctrl+Enter steer/queue flip.
website/src/pages/chat/composerFocus.ts, website/src/pages/chat/SideChat.tsx, website/src/styles/cli-mode.css Focus intents (Alt+Enter, focus after creating a chat, quote-to-compose, widget pre-fill, the macOS keyboard-switch blur, the side chat's Select-to-Ask seed) found the composer with textarea[data-composer-input], which misses the Lexical composer's div. They now match [data-composer-input] on either element, and the side chat's seed waits (MutationObserver, 5 s cap) for the lazy-loaded Lexical composer to mount before placing the caret. Focusing the Lexical composer collapses the caret to the end of its text (focusComposerElement), matching where a textarea leaves it after a pre-fill, and a seed whose composer mounts late leaves focus alone if the user has moved to another field. CLI mode's prompt-glyph indent and accent caret use the same selector, and the Lexical placeholder overlay (data-composer-placeholder) gets the same indent.
website/src/pages/chat/ChatSettings.tsx, website/src/hooks/useComposerInlineMarkdown.ts, website/src/pages/settings/ChatPanel.tsx inlineMarkdown in mc-chat-config, default false, non-booleans coerced to false. Settings → Chat → Composer → Style Markdown While Typing. The description's second sentence says turning it on also switches the message input to a rich-text editor that is still in beta, and that turning it off goes back to the plain input.
website/src/i18n/locales/ Two strings in en.manual.json and every locale, informal address per the style guides; en-XA.json regenerated.
website/src/components/commandPalette/settingsKeywords.ts, settings registry, docs/feature-map/README.md A search-keyword entry so the command palette finds the setting (the same shape as every sibling setting), npm run gen:settings output, and a feature-map row.

Backwards compatibility

Compatible. The setting defaults to off, and off renders the same textarea as before. A user with no stored config, or a stored non-boolean, gets off.

Tests

  • website/src/test/ChatInput.inlineMarkdownSetting.test.tsx: setting off gives a textarea with no styled element; setting on gives the Lexical composer with hi in a bold element and the ** markers still in the text; switching the setting off live returns to the textarea with the draft kept.
  • website/src/test/InlineMarkdownPlugin.test.tsx: styles while typing, caret stays put when a span closes, unmatched markers stay plain, no styling across a paste chip, disabling clears formats, undo returns to the earlier text with its own styling, turning styling on over an edited draft adds no undo step of its own, text under IME composition is left alone.
  • website/src/test/ChatInput.lexicalUndo.test.tsx: on the Lexical composer, Ctrl+Z after Optimize restores the original draft and Ctrl+Shift+Z redoes it; the same keys undo and redo typed text through the snapshot history.
  • website/src/test/ChatInput.lexicalKeys.test.tsx: on the Lexical composer, Ctrl+Shift+Enter optimizes and Ctrl+Enter performs the one-off steer/queue flip while a turn runs, as on the textarea.
  • website/src/test/SideChat.lexicalSeedFocus.test.tsx: with the setting on, a Select-to-Ask seed focuses the Lexical composer once it mounts.
  • website/src/test/SideChat.lexicalSeedLateFocus.test.tsx: a seed whose Lexical composer mounts late does not take focus from a field the user moved to.
  • website/src/test/composerFocus.richCaret.test.ts: revealComposer and focusComposer leave the caret at the end of a contenteditable composer's text.
  • website/src/test/InlineMarkdownPlugin.parseOnce.test.tsx: a closing marker that restyles a many-node run parses it once.
  • website/src/test/composerFocus.test.ts: queryComposer, focusComposer and the keyboard-switch blur all reach a contenteditable div[data-composer-input].
  • website/src/test/useComposerInlineMarkdown.test.ts: default off, a non-boolean stored value reads as off, follows the saved setting live.

90 related frontend test files pass, plus npm run typecheck, eslint, lint:i18n, i18n:check and check_feature_map.py.

Manual verification

Built the SPA from this head and ran it on the repo's feature-gateway harness (fixture="minimal"). Typed Ship **bold**, *italic*, ~~old~~ and `code` today with real key events. With the setting off the composer was a TEXTAREA showing raw characters. After turning the toggle on in Settings, the composer was a DIV with data-lexical-composer, and the DOM had a font-bold element containing bold.

Screenshots / video

Setting off (default): plain textarea, raw markdown.

Setting off, dark: the textarea shows Ship bold, italic, old and code today as raw characters

Settings → Chat → Composer, toggle on.

Settings Chat Composer: Style Markdown While Typing toggle on, with its description

Setting on: the same text styled, markers in the theme's muted colour.

Setting on, dark: bold, italic, strikethrough and code styled in the composer

Setting on, light: bold, italic, strikethrough and code styled in the composer

CLI interface mode, setting on: the placeholder and the typed text both clear the > prompt glyph (computed padding-left: 24px on [data-composer-input] and [data-composer-placeholder], accent caret).

CLI mode, setting on, empty: the Lexical placeholder starts clear of the > glyph

CLI mode, setting on, typed: Ship bold and code today, styled, clear of the > glyph

Related Issues

Fixes #15030

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@Pearcekieser
Pearcekieser requested a review from a team September 29, 2026 15:06
@Pearcekieser
Pearcekieser requested a review from a team as a code owner September 29, 2026 15:06
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 29, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: A user who turns on Settings → Chat → Composer → Style Markdown While Typing sees bold, italic, strikethrough and inline code styled in the composer as they type, on the Lexical composer the setting switches them to; the sent text is exactly what they typed.
Not a goal: Changing the default composer (the setting is off by default and off keeps the textarea), hiding markdown markers, or styling block markdown and links.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — 🟡 CONCERNS

UX-level review of 274a0af692bec97a87f08ec7229750a9421cd3ec via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

No first-time reader has looked at the new "Style Markdown While Typing" toggle or the styled composer; the screenshots show both, but this lane has no blind read.

Watch

  • The hint for the new setting is the longest in its group. It runs to four sentences: "Show bold, italic… Turning it on also switches… to a rich-text editor that is still in beta; turn this off to go back… The markdown markers stay visible and the message you send is unchanged." Attachment 2 shows it as a four-line paragraph, while the toggles beside it use one or two sentences. That length buries the one thing that matters for the decision, the beta-editor trade-off, in a dimmed paragraph a user skims past. This is low severity: people open this setting once, but the beta warning is exactly what they need to read. Fix: keep the first sentence and the beta clause, and drop the last sentence, which restates what the screenshots show.
  • Inline code has almost no background in the light theme. In attachment 4, the code chip behind code is barely visible against the light composer. A user reading the draft can't easily tell where the code span ends, which is the boundary this PR exists to show. This is low severity: it affects light-theme users only, every time they type inline code. Fix: give the inline-code class in the Lexical theme a background token with visible contrast on light surfaces, such as the one the transcript's inline code uses.

Suggestions

  • inline_markdown_input_desc: "Show bold, italic, strikethrough and inline code in the message input as you type. This uses a beta rich-text editor; turn it off to return to the plain input."

[UX-REVIEWED] 274a0af

Description read

[DESCRIPTION-READ] 85daca021381f1b884dbd26650e724b45c013099e91e9b02f91dc3317d57aacf

That sha256 names everything this verdict read: the PR description, plus the 9 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — 🟡 CONCERNS

Design-level review of 274a0af692bec97a87f08ec7229750a9421cd3ec via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A display toggle is now the only way users reach the beta Lexical composer, so its gaps against the textarea ship as side effects of "style markdown."

Watch

  • The setting doubles as the beta opt-in. const lexicalComposer = lexicalComposerProp || inlineMarkdown makes a styling preference the only route into an editor that props.ts still calls a migration slice, kept off "until parity is complete." This PR closes the gaps it found one by one: undo through HostHistoryPlugin/stepUndoHistory, the optimize chord, the steer/queue flip, focus selectors and the side-chat seed wait. Nothing lists which textarea behaviours the Lexical path still lacks, and the feature-map row already says to "route editor parity reports to the Lexical migration." A user who turns on bold styling and then loses some textarea behaviour has no clue the setting caused it. Turning it off does fix it, which is why this is CONCERNS and not a block.
    Clears when: the PR, or the feature-map row, lists every textarea-only behaviour in ChatInput (via useComposerKeyDown / useTextareaListContinuation / inputRef consumers) as either covered on the Lexical path or knowingly missing.

Suggestions

  • Keep lastParse per editor (a ref inside the plugin) instead of at module scope. Several composers are mounted at once (split panes, side chat), and a per-editor cache stays local to the plugin that owns it.

[DESIGN-REVIEWED] 274a0af

Description read

[DESCRIPTION-READ] 8553761a033ebbc4126cb7b6f7a9b54678bd0f7935d42c714b7d7cfc03ef1c3f

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 274a0af692bec97a87f08ec7229750a9421cd3ec via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 274a0af

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 274a0af692bec97a87f08ec7229750a9421cd3ec via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The parse cache rests on no measured cost, and the side chat's caret code duplicates the focusComposerElement helper this same diff adds.

Not justified as shipped

  • Item 8 — inherited: the module-global lastParse cache in InlineMarkdownPlugin.tsx ("keeps one keystroke at one parse") has no measured cost behind it. The parseOnce test counts parse calls, not time, and the parser it saves calls to is described as "small".
    Subtraction: delete lastParse and parseRunText, and call parseInlineMarkdown directly in $applyInlineMarkdown. Also delete InlineMarkdownPlugin.parseOnce.test.tsx.
    Clears when: a profile of a realistic draft shows repeated parsing costs visible input latency.
  • Item 9 — duplicate of focusComposerElement (pages/chat/composerFocus.ts): the else branch of place in SideChat.tsx repeats selectAllChildren(el) and collapseToEnd(). Grepping both calls finds 2 copies, both added by this diff.
    Subtraction: replace that branch with focusComposerElement(el).
    Clears when: SideChat.tsx calls the shared helper.

What this change ships

Inventory (9 items) — 7 justified

Intent: let a user who opts in see inline markdown styled while typing. ADDITION.

  1. New Settings → Chat → Composer toggle, off by default — justified
  2. Bold, italic, strikethrough and code styled in the composer, markers dimmed — justified
  3. Turning the toggle on switches that user to the beta Lexical composer — justified
  4. Undo and redo on Lexical walk the textarea's snapshot history — justified
  5. Cmd/Ctrl+Shift+Enter optimizes and Cmd/Ctrl+Enter flips steer/queue on Lexical — justified
  6. Focus shortcuts and pre-fills find the Lexical composer, caret at the end — justified
  7. CLI-mode indent and caret apply to the Lexical input and placeholder — justified
  8. One parse per keystroke through a module-level cache — inherited: no measured cost
  9. Side chat seed waits up to 5 s for the lazy-loaded composer — duplicate of focusComposerElement (caret code)

[FIRST-PRINCIPLES-REVIEWED] 274a0af

Description read

[DESCRIPTION-READ] caaacacc7a507cd4a133ed7f25c4c4d16f5fd2ce78943987b1fd48c1aaf2a147

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Feature map falsely claims parser parity

issue (fixed, blocking): upheld. The row said the spans come from the same parser the transcript uses. They don't: composerInlineMarkdown.ts is a standalone parser that follows the CommonMark emphasis rules for common cases.

Fixed in the next head. The feature-map row now says the parser is not the transcript's renderer and that an edge case can style differently from the sent bubble. The PR body and issue #15030 carried the same claim and are corrected too.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Premise risk: "the composer and the sent bubble agree" rests on parser identity that does not exist

issue (fixed, blocking): upheld, and the clause is deleted, which is this item's own clear condition.

The feature-map row, the PR body and issue #15030 now say the composer parser follows CommonMark emphasis for common cases and is not the transcript's renderer. The feature's value doesn't depend on parity: the sent text is always exactly what was typed, and the styling is only a preview of where the markers pair up.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • "the new message editor" is an internal codename in user copy

suggestion (fixed, non-blocking): upheld.

The description now ends "Turning it on also switches the message input to a rich-text editor that is still in preview." That says what changes (the input becomes a rich-text editor) and what is at stake (it is in preview). The wording is updated in all 12 locales, and the Settings screenshot is recaptured with the new text.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Check that markers at opacity 0.55 stay legible in light theme

note (checked, non-blocking): checked by a human reader.

I read the light-theme frame (the fourth screenshot in the body). The **, *, ~~ and backtick markers are visibly lighter than the styled words but clearly readable against the white composer. That is intended: they're dimmed so the styled word stands out, and not hidden, so the text you edit is the text you send.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • This setting is now the only production gate on the Lexical editor; route parity reports to the migration

suggestion (applied, non-blocking): applied.

The feature-map row now says that no other call site passes lexicalComposer, so this setting is the only way users reach the Lexical composer, and that editor parity reports go to the Lexical migration.

@Pearcekieser
Pearcekieser force-pushed the feat/composer-inline-markdown-render branch from be5bc54 to 06a4278 Compare September 29, 2026 15:36
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed 06a4278 (rebased on main 3afc7cd). This head addresses round 1: the parser-parity claim is removed from the feature-map row, body and issue; the setting description no longer says "the new message editor"; the feature-map row routes editor parity reports to the Lexical migration; the Settings screenshot is recaptured. Dispositions are posted above.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 274a0af692bec97a87f08ec7229750a9421cd3ec via the fork AI-review pipeline; updated in place on each push.

Review details

All three candidates fell apart once I checked them against the code:

  • Candidate 1 (caret jumps to end): Moving the caret to the end is deliberate. On the Lexical composer, calling focus() alone puts the caret at offset 0, so the user's earlier caret position is lost either way. There is no concrete wrong outcome beyond that.
  • Candidate 2 (optimize chord not gated on terminal mode): In terminal mode, optimizePrompt returns early (optimizer.ts:199), so the chord simply does nothing. That is harmless, and it doesn't reach the 80-confidence bar for a defect.
  • Candidate 3 (selection restored while unfocused): Whether Lexical moves focus back into an unfocused editor depends on how Lexical commits the DOM selection, which I couldn't establish. That leaves no concrete failure path.

No findings.

[OPUS-REVIEWED] 274a0af

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 29, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • "still in preview" names a program, not a consequence; end with the exit

suggestion (applied, non-blocking): applied.

The description now ends "...a rich-text editor that is still in preview; turn this off to go back to the plain input." The wording is updated in all 12 locales, and the Settings screenshot is recaptured with the new text.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • $applyInlineMarkdown is exported "for tests" with zero importers

chore (fixed, non-blocking): upheld, and the export is removed, which is this item's own clear condition.

$applyInlineMarkdown is now module-private in InlineMarkdownPlugin.tsx. The tests drive it through the editor, as the reviewer noted, so they are unchanged and still pass.

@Pearcekieser
Pearcekieser force-pushed the feat/composer-inline-markdown-render branch from 06a4278 to 82f6ebc Compare September 29, 2026 16:06
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed 82f6ebc (rebased on main d5c799b). This head addresses round 2: the setting description now ends with how to turn it back off, $applyInlineMarkdown is no longer exported, and the Settings screenshot is recaptured. Dispositions are posted above.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 29, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4224aa2 with no code change (head b86ac34). This reruns the lanes that the CI-app quota killed in round 21. gen:settings, typecheck, eslint and 157 related frontend test files pass locally.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • The setting switches every composer to the beta editor with no sign at the point of typing

note (acknowledged, non-blocking): that is the intended trade for this PR. The setting is off by default, and its description says it turns on a rich-text editor that is still in beta, so the person who flips it has been told which editor they get. It applies to every composer on purpose, so a draft never changes editor between the main chat, side chat and grid panes. An in-composer badge is a fair follow-up once the editor leaves beta; it would add UI to every composer for a state the user chose in Settings.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Drop "; turn this off to go back to the plain input" from the description

suggestion (acknowledged, non-blocking): agreed that the clause is redundant with the toggle. It touches all 12 locale files, so I will fold the trim into the next push this PR needs for another reason, rather than spend a full CI round and shared runner quota on wording alone.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Drop "; turn this off to go back to the plain input" from the description (update)

suggestion (acknowledged, non-blocking): correcting my earlier reply. The next push is a conflict-only rebase onto #15911, and the trim is not in it. Trimming the clause in all 12 locales would also leave the Settings screenshot in this PR showing the old text, so it needs a recapture with it. I will send the trim and the new screenshot as a small follow-up after this PR merges, so this rebase changes nothing.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main 3d465a6 (head ddb65e1). The conflict with #15911 is resolved with no behaviour change: both undo-history exports (endUndoBurst and stepUndoHistory) are kept. Typecheck, eslint and 159 related frontend test files (2,468 tests) pass.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Draft carries over on a live toggle

note (acknowledged, non-blocking): the main composer case is covered by a test, not only the description. ChatInput.inlineMarkdownSetting.test.tsx "follows a live toggle back to the textarea without losing the draft" types a draft, flips the setting, and asserts the textarea holds the same text. The side chat renders the same ChatInput and reads the draft from the same store, so it takes the same path, but no test drives the toggle there. A maintainer flipping the toggle with a draft in both composers before merge is a fair hands-on check.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Dimmed markers vs body text in dark theme

note (acknowledged, non-blocking): the markers use var(--muted), the same token the dashboard uses for secondary text in every theme, so their contrast against body text matches what users already read as "quieter" elsewhere. Whether that gap is wide enough on a real dark monitor is a fair eyes-on check for a maintainer; if it reads as the same brightness, a marker-specific opacity can follow without changing this PR's behaviour.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • The run is re-parsed once per dirty node

issue (fixed in af20f557b8, pending push): confirmed. Typing the closing * of **i** at the end of a nine-segment line parsed the full run 6 times for one keystroke. The plugin now keeps the last parse keyed on the joined run text, so the transforms Lexical runs for each node $rewriteRun touched reuse it. The parser is pure, so a hit returns what a fresh parse would. InlineMarkdownPlugin.parseOnce.test.tsx asserts one parse for that keystroke; it saw 6 before the change.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Bare focus() on the rich composer puts the caret at offset 0

issue (fixed in af20f557b8, pending push): agreed. A new focusComposerElement in composerFocus.ts focuses the element and, when it is not a textarea, collapses the DOM selection to the end, the same move the side chat's seed nudge already makes. focusComposer, revealComposer, the quick-search focus, Alt+Enter and the new-chat shortcut all go through it now. composerFocus.richCaret.test.ts failed before the change (caret not at the end after revealComposer and focusComposer) and passes after it. The textarea path is unchanged.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Late seed focus pulls focus out of another field

issue (fixed in af20f557b8, pending push): agreed. When the composer mounts after the first frame (through the observer or the 5 s cap), the nudge now skips place(el) if activeElementIsEditable() is true, the same guard focusComposerNow uses. The seed is still consumed. The first-frame path is unchanged, since nothing has had time to move focus there. SideChat.lexicalSeedLateFocus.test.tsx focuses another input while the editor chunk loads and checks that it keeps focus; it failed before the change. It is in its own file because an already-loaded chunk would take the first-frame path instead.

@dwu96

dwu96 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: dwu96#8c08bee0]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author.

Assessment: no review lane blocks this PR. At head ddb65e12f7 GPT 5.6 and Opus 5 both report no blocking findings, Design is PASS, First Principles is PASS, and UX is CONCERNS (advisory). Three blockers remain and all three are mechanical:

  1. Merge conflict — rebase onto current main and force-push with lease. Your notes record the recent conflicts as the undo-history exports shared with fix(composer): continue markdown lists on the textarea's new line #15911 and the chat-input/ module split from refactor(website): split ChatInput into chat-input owners #15284; both are take-main-structure, keep-PR-logic.
  2. Backend Tests (Windows) (3) — one failure out of 16,791 passed: test/test_apps_backend_coverage.py::TestSpawnPublicationOwnership::test_restart_joins_a_public_start_already_in_flight, failing on assert not public_thread.is_alive() after a 2s event wait. This PR changes no backend code at all — its diff is entirely website/src/**, two docs lines and the generated settings registry — so it cannot be the cause. Thread-liveness timing, cleared by the rebase or a rerun.
  3. Backend Lint & Type Check (3.12) CANCELLED — not a failure; no verdict was produced. A new head re-runs it.

I'll also fold in the three Opus findings you marked fixed at this head (spans 7d8ceb9d397c re-parse per dirty node, 2bfe879dbb39 bare focus() caret offset, 3b327dbeda0f late seed focus) if they are not already in the tree, and will not touch the UX advisory copy decisions — those are yours.

If you'd prefer I don't touch this PR, add the pr-no-autofix label.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): rebased on main 9bf943b0f9, pushed as de559b1922.

@dwu96 thanks for the 10-05 note. The branch hadn't moved since, so I'm taking it back from here.

This head also carries the fixes for the three Opus findings on ddb65e12f7 (caret at the end on rich focus, one parse per restyle, no late seed focus steal), which I replied to earlier.

Two conflicts, both resolved with no behaviour change to either side:

  • ChatSettings.tsx DEFAULTS: kept main's line and added inlineMarkdown: false.
  • composerFocus.ts: main's Split view: a session opened from Cmd/Ctrl+K should put the caret in that session's pane #15937 made focusComposerNow(key) resolve the pane bound to the opened slot. I kept that and routed the found element through this PR's focusComposerElement, and the pane lookup now matches [data-composer-input] instead of textarea[data-composer-input] so the Lexical composer is found in split view the same way queryComposer already finds it.

gen:settings had nothing to regenerate. Typecheck, eslint, and 115 related frontend test files (2,109 tests, including the split-view focus tests) pass.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed c581316f3a to fix the two red checks on de559b1922. Both were real.

  • PR Hygiene: the PR had 3 commits. I squashed the Opus-fix commit into the second commit, so it now has 2. Apart from the test below, the tree is identical to de559b1922.
  • SAST (Semgrep) test-promise-sleep: SideChat.lexicalSeedLateFocus.test.tsx slept 50 ms before checking focus. It now runs waitFor on a spy around consumeSideChatSeed, which SideChat calls right after it decides whether to focus. With the late-focus guard removed, the test fails. With the guard in place, it passes.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Round on c581316f3a: the only red so far is Backend Tests (Windows) shard 1, and it isn't from this PR.

test/test_dashboard_server_coverage.py::TestWindowEntryHandler::test_handler_follows_a_re_pointed_dist failed with PermissionError: [WinError 32] (a temp file still held open on the Windows runner). The other 18,242 tests in the shard passed. This PR changes no backend code; it looks like the Windows file-lock flake class tracked in #15412.

Could a maintainer rerun that job? I'm not pushing for it.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): replies to the UX watch items on c581316f3a.

Beta warning buried in the description. Agreed, and this is the same trim UX suggested on round 22. It changes the description in all 12 locale files and makes the Settings screenshot in this PR stale, so I'm doing it as a small follow-up PR right after this one merges. That PR will lead with the beta sentence and drop the closing sentence that repeats the first, using the wording UX suggested for en.manual.json.

Inline code hard to see in the light theme. Agreed. The code span uses the bg-bg-elevated fill, which barely shows against the white composer. I'll put a higher-contrast light-theme background or a 1px border in the same follow-up PR, with a light and a dark screenshot. Leaving it out of this PR keeps the current head as reviewed. The setting is off by default, so until the follow-up lands this only affects users who turn it on.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Fixed in the next push. Not pushed yet, waiting on a push slot.

issue (blocking): lazy-composer waits omit the explicit timeout. Upheld. The Lexical composer mounts behind ChatInput's React.lazy boundary (components/chat-input/engine.tsx), and these findByRole calls used the 1 s default.

Every composer-mount findByRole in the five tests GPT named now passes LAZY_COMPOSER_MOUNT = { timeout: 5000 }. That's 8 calls across ChatInput.inlineMarkdownSetting, ChatInput.lexicalKeys, ChatInput.lexicalUndo, SideChat.lexicalSeedFocus and SideChat.lexicalSeedLateFocus. Each file declares the constant with a comment that names the lazy boundary. The PR's other new findBy* is in InlineMarkdownPlugin.test.tsx, which renders LexicalComposerInput directly with no lazy boundary, so I left it alone.

This fix only changes test timing, so it can't produce a test that fails first. The five files pass (9 tests), and eslint and tsc -p tsconfig.app.json are clean. The fix is folded into the second commit, so the PR stays at 2 commits.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed 7bdcf8b3fd (lease on c581316f3ae9). This fixes GPT's round-24 blocking finding: every composer-mount findByRole in the five new lazy-Lexical tests (8 calls) now passes an explicit { timeout: 5000 }, and each file names the lazy boundary it waits on. Still 2 commits, same base 9bf943b0f9, no product-code change. The push also reruns the cancelled Backend Lint 3.12 job. The Windows shard 1 red was an unrelated WinError 32 flake (#15412).

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Round 25 on 7bdcf8b3fd: Backend Tests (Windows) shard 7 failed in test/test_runtime_cleanup_windows.py::test_a_child_exiting_259_reads_as_exited_and_its_drain_finishes[True] with AssertionError: helper did not attach. This PR changes no backend code, so it isn't caused by this diff. Could a maintainer rerun that job? I'm not pushing for it.

A Lexical TextNode transform restyles each edited run of composer text
from parseInlineMarkdown: bold, italic, strikethrough and inline code
get Lexical format bits, markers get a dimmed style. The editor stays in
plain-text mode, so the stored and sent value is unchanged. Settings >
Chat > Style Markdown While Typing turns it on; default off.
…exical composer

A textarea cannot draw styled text, so Style Markdown While Typing now
also opts the user into the Lexical composer. With the setting off (the
default) ChatInput keeps the textarea. The setting description says so
in all locales.

Focusing the rich composer puts the caret at the end, the restyle
parses each line once per edit, and a side-chat seed whose editor
mounts late leaves focus where the user moved it.
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main 0d885e681a with no code change; new head 274a0af692. This reruns the two infra reds on 7bdcf8b3fd: Backend Lint & Type Check (3.12), cancelled twice at the 25-minute cap in mypy, and the Windows shard 7 test_runtime_cleanup_windows.py flake. The PR touches no backend code. gen:settings, typecheck, eslint and 19 related frontend test files (187 tests) pass on the new head.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Backend Lint & Type Check (3.12) on 274a0af692 hit the job's 25-minute limit again, for the third round in a row, and was cancelled in the mypy step. This PR changes no Python code.

The job runs close to that limit across the repo. On this run, black (baselined) took 15m10s and flake8 took 3m18s, so mypy started at minute 23. Other PRs' runs of this job in the same hour spent 9.5 to 15 minutes in black and took 21 to 23.5 minutes in total.

Could a maintainer rerun this job? I won't push again for it, because a new head lands in the same queue. Raising timeout-minutes on this job, or splitting mypy into its own job, would stop it timing out.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 274a0af6. The plugin only sets Lexical format bits and a marker style, so the sent text stays the plain markdown the user typed, and the setting is off by default. Undo, focus and the side-chat seed paths are covered by tests on the Lexical composer. GPT and Opus pass, the other lanes are advisory, and all checks are green after the lint rerun.

Two of the advisory notes are worth a small follow-up: keep lastParse per editor instead of at module scope, and have SideChat.tsx call focusComposerElement instead of repeating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composer: style inline markdown while typing, as an opt-in setting

6 participants