Skip to content

fix(composer): continue markdown lists on the textarea's new line - #15911

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/mobile-enter-list-continuation
Oct 2, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:fix/mobile-enter-list-continuation

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Typing 1. test and pressing Return on a phone starts the next line with 2. , the way #14754 promised.

A user reported that numbered-list continuation does nothing when they press Enter in mobile view. It reproduces on current main, and not only on mobile. In every layout, 1. test followed by a new line gives a bare newline. That includes a 390px touch viewport, a 600px window with a physical keyboard, and desktop Shift+Enter.

Why it matters

#14754 shipped list continuation, but no user can reach it. Anyone writing a numbered or bulleted prompt has to type every marker by hand. On a phone keyboard that is the slowest part of writing a list.

Not a goal

What changed (motivation → approach → change)

A new line on a markdown list item now continues the list in the composer people actually type in, on phones and on desktop. Before, the continuation from #14754 never ran there.

Every production host renders the textarea composer. The Lexical editor is opt-in (lexicalComposer defaults to false and no caller sets it), and #14754 put list continuation only in the Lexical editor. Mobile hosts run in ctrl-enter mode below 768px, so Return there is a plain textarea newline that nothing intercepts.

A keydown check cannot fix this for phones. Android Gboard sends keydown key: "Unidentified" with keyCode 229, and iOS sends keyCode 229 while autocorrect has marked text. What every new-line path does fire is a native beforeinput with inputType insertLineBreak (or insertParagraph on some Android keyboards). That covers a mobile Return, desktop Shift+Enter and Enter in ctrl-enter mode. The send key never produces one, because its keydown is default-prevented.

chat-input/listContinuation.ts listens for that event on the textarea and runs #14754's pure listLineBreakEdit on the text and caret, with paste chips as protected ranges. When the line is a list item it cancels the native break and writes the edit itself, then fires an input event. React's onChange then records it as a normal user edit. It first ends the composer's current undo burst, so a Return typed right after the item's text is its own undo step and one Ctrl+Z removes only the new marker. A composing beforeinput is left to the IME. So is the WebKit Enter that commits a CJK candidate: it arrives after compositionend with isComposing false and keyCode 13, so the textarea's keydown asks the shared IME guard (useImeGuard) and marks that one line break as the IME's. A Gboard Return right after a composed word has keyCode 229 and still continues. The listener is attached through a callback ref, so a textarea that remounts (composer collapse and expand, the approval bar, a Lexical load failure) gets it too. Ctrl+Enter in enter-ctrl-newline mode inserts its newline in keyboard.ts without a beforeinput, so that branch calls the same edit first, unless the IME guard says the key is the IME's.

Backwards compatibility

Compatible: only a new line on a markdown list item changes. Plain lines, the send key in all three modes, IME commits and paste chips behave as before.

Tests

website/src/test/ChatInput.listContinuation.test.tsx renders the real ChatInput and dispatches the native beforeinput a browser sends. It covers:

Case Locks in
keyCode 229 keydown, then insertLineBreak (ctrl-enter mode) the mobile Return continues 1. to 2., no send
insertParagraph 9) continues to 10)
bullet with text after the caret - continues and the rest of the line moves down
empty item the marker is removed, ending the list
one Ctrl+Z, including right after fast typing (beforeinput and Ctrl+Enter paths) reverts only the continuation, not the typed item
plain line, composing break, caret inside a paste chip the native break is untouched
WebKit candidate-commit Enter (keyCode 13 just after compositionend) no marker is added to a CJK draft
Gboard Return (keyCode 229 just after compositionend) the list still continues
latched commit Enter claimed as a send a later new line still continues
textarea mounted after expanding a collapsed composer the remounted textarea continues the list
enter mode Shift+Enter continues, plain Enter still sends
enter-ctrl-newline mode Ctrl+Enter continues and does not send
enter-ctrl-newline mode while the IME owns the key Ctrl+Enter inserts a plain newline, as on main
ctrl-enter mode Ctrl+Enter still sends a list draft

With the production change removed, 13 of the 18 fail.

Manual verification

No physical phone was used. I drove the built dashboard (an isolated feature gateway) in Chromium with Playwright, in three contexts. One was 390x844 with isMobile, hasTouch and an iPhone Safari user agent. One was 600x900 with a physical keyboard. One was a 1400x900 desktop. Each case typed 1. test with real key events and then made a new line as follows:

  • a real keyboard.press('Enter') (Shift+Enter on desktop);
  • iOS Return: synthetic keydown Enter/13, then beforeinput insertLineBreak;
  • iOS autocorrect: keydown Enter/229 with isComposing, compositionend, then insertLineBreak;
  • Android Gboard: composition over the word, keydown Unidentified/229, then insertLineBreak;
  • the same Gboard sequence ending in insertParagraph.

On main every case gave 1. test\nnext. With this change every case gives 1. test\n2. next, in all three contexts. A second new line on the empty 2. ends the list, - a continues to - , and desktop plain Enter still sends the draft. The page renders the textarea in all three contexts.

Screenshots / video

Mobile, 390px, after typing 1. test, Return, second:

main this PR
before mobile after mobile
Desktop, 1400px, Shift+Enter
main this PR
before desktop after desktop

Related Issues

no linked issue: reported directly; follows up #14754, whose continuation only ran in the opt-in Lexical editor.

Pattern harvest

Rule candidate: review-prompt
Pattern: a composer behaviour added only to the opt-in Lexical editor never reaches users while the textarea is the production composer; ask whether the textarea path got the same change.

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 October 1, 2026 15:31
@Pearcekieser
Pearcekieser requested a review from a team as a code owner October 1, 2026 15:31
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: A new line on a markdown list item (mobile Return, desktop Shift+Enter, Enter in ctrl-enter mode) continues or ends the list in the textarea composer that production renders, using #14754's existing list rules.
Not a goal: Changing send-key behaviour, enabling or changing the Lexical editor, or adding list rules beyond #14754.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

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

Design-Verdict: PASS

Verify once on a real Android/iOS keyboard: every mobile event sequence here was synthesized in Playwright, never produced by a physical virtual keyboard.

[DESIGN-REVIEWED] 0367cf0

Description read

[DESCRIPTION-READ] b952aa5d634a492c61ac9a3aba825ec8ee3a6627ee7701e0386b429e74a6a87c

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 Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

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

UX-Verdict: PASS

Verify on a real phone (Gboard + iOS autocorrect) and a CJK IME — all mobile evidence here is synthesized Playwright events, not device keystrokes.

The diff adds no new control, label, or string: it changes only what a line break does on a markdown list line in the existing composer, a universal editor convention. Before/after stills cover both postures (mobile 390px: attachment-01 1. test / second → attachment-02 2. second; desktop: attachment-03 → attachment-04), matching the description's claims. Exit paths hold: Enter on the empty item removes the marker, and one undo reverts only the continuation (both pinned in ChatInput.listContinuation.test.tsx). No persistent element changes form or place, so no recording is required.

[UX-REVIEWED] 0367cf0

Description read

[DESCRIPTION-READ] dc9a1a9e6ea07b514c0c6dfcd397d9929dbe3007ddf07dcf7829917ced3d596d

That sha256 names everything this verdict read: the PR description, plus the 7 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 Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 0367cf0

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of 0367cf0621471dcf0bd0525652b142041b2cff10 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: PASS

All mobile-keyboard behaviour (Gboard/iOS keyCode 229, beforeinput sequences) was verified only in emulated Playwright contexts — worth one check on a physical phone.

What this change ships

Inventory (8 items) — 8 justified

Intent: make the list continuation #14754 shipped actually run in the textarea composer every production host renders — a FIX (defect reproducible from base: listLineBreakEdit has one consumer, the opt-in Lexical editor; lexicalComposer defaults false and no production host sets it; 13 of the 18 added tests fail on base).

  1. A new line on a markdown list item in the composer now continues or ends the list (mobile Return, Shift+Enter, Enter in ctrl-enter mode) — justified
  2. Ctrl+Enter's manually inserted newline in enter-ctrl-newline mode continues the list too — justified
  3. The continuation is its own undo step; one Ctrl+Z removes only the new marker — justified
  4. A WebKit IME candidate-commit Enter leaves a CJK draft untouched; a Gboard Return after a composed word still continues — justified
  5. A textarea that remounts (composer collapse/expand, Lexical load failure) keeps the behaviour — justified
  6. New module exports useTextareaListContinuation / applyTextareaListBreak (counted: 2 call sites, the beforeinput listener and keyboard.ts) — justified
  7. endUndoBurst exported from useUndoHistory (counted: 2 consumers; thin accessor over the existing undoLastEditRef) — justified
  8. useComposerKeyDown gains pasteBlocksRef/endUndoBurst plumbing (1 consuming branch each) — justified

Reuse checked: both paths route to the existing pure listLineBreakEdit; no second spelling of the rules. Lens 9: not product shape — delivers behaviour #14754 already recorded and composerListContinuation.test.ts pins on base, with "Not a goal" explicitly excluding new rules.

[FIRST-PRINCIPLES-REVIEWED] 0367cf0

Description read

[DESCRIPTION-READ] 5cacd274ceb6f9c28e6959fbf05df5f97b2eaedd319b536c49e735ebd7a93954

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.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 0367cf0

@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 Oct 1, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: textarea keydown marks a WebKit IME commit Enter so its line break is not a list item

  • issue (non-blocking): IME commit Enter gets a list marker in ctrl-enter mode, fixed

fixed in 2bb94a5e97: the textarea keydown asks the shared useImeGuard whether an Enter (keyCode not 229) is the IME's; if so, the one beforeinput it produces is left to the browser.
The latch alone is not used as the gate. Gboard composes every word, so a Return right after one lands in the same 50 ms window with keyCode 229, and that newline must still continue the list.
Tests: WebKit commit Enter adds no marker; Gboard 229 Return inside the window continues; a commit Enter claimed as a send does not decline the next new line.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): CONCERNS cap, typing behaviour seen only in stills

rebutted: the verdict lists no Blocker, Watch, Subtraction or Suggestion item, and names the cap as the lane's limit, not an author gap.
The behaviour is a text edit on a new line. The description records the exact before/after values for every emulated event sequence in three layouts, and the mobile and desktop stills show the resulting draft.

@Pearcekieser
Pearcekieser force-pushed the fix/mobile-enter-list-continuation branch from 499616e to 28d9dab Compare October 1, 2026 16:46
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: list continuation ends the composer undo burst before it writes the value

  • issue (blocking): continuation merges into the typing undo step, fixed

fixed in df4368109b: useUndoHistory returns endUndoBurst (the undoLastEditRef.current = 0 pattern removeFileEndingUndoBurst already uses), and applyTextareaListBreak calls it right before writing the value, on both the beforeinput path and the enter-ctrl-newline Ctrl+Enter path.
The continuation is now its own undo entry even when Return follows the item's text inside the 400 ms coalesce window. One Ctrl+Z restores 1. test.
Tests: fast typing of 1. test then a new line, and fast - a then Ctrl+Enter, each followed by one Ctrl+Z; the first fails on 28d9dab (expected '' to be '1. test').

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • question (non-blocking): real-device confirmation of the keyboard event model

needs-a-decision: no physical Android or iOS device is reachable from the author's environment, and the description says so. The emulated sequences are the documented ones (Gboard keydown Unidentified/229 then insertLineBreak/insertParagraph; iOS Return insertLineBreak; WebKit commit Enter after compositionend).
The fix keys on beforeinput inputType, which every textarea newline produces whatever the keydown says, so it does not depend on the keydown shape for the main path; only the CJK decline reads the keydown.
Question for a maintainer: could someone with a phone confirm 1. test + Return gives 2. on Android Gboard and iOS Safari before merge, or rule that the emulation is enough?

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): behaviour-only change, stills plus recorded values

rebutted as an action item: the Watch item records the change as low risk and names no gap. The behaviour is a text edit shown at 390px and desktop, with the exact before/after values for every emulated sequence in the description; one Ctrl+Z reverts the continuation as its own undo step.

@Pearcekieser
Pearcekieser force-pushed the fix/mobile-enter-list-continuation branch from 28d9dab to 5116f1f Compare October 1, 2026 18:01
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: enter-ctrl-newline Ctrl+Enter list continuation is skipped while the IME guard owns the key

  • issue (blocking): Ctrl+Enter bypasses the IME guard, fixed

fixed in f1a27fc9fd: the Ctrl/Cmd+Enter branch in useComposerKeyDown only calls applyTextareaListBreak when ime.isComposing(e) is false. That guard covers the latch window and both native signals.
An IME-owned Ctrl+Enter falls through to the branch's existing plain-newline code, unchanged from origin/main, so no marker reaches a composing draft. claimEnter is not added, so the branch's base behaviour does not change.
Test: enter-ctrl-newline, - a, compositionstart/compositionend, Ctrl+Enter gives - a\n; it fails on 5116f1f with - a\n- .

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • issue (non-blocking): Ctrl+Enter list continuation runs during a live composition, fixed

fixed in f1a27fc9fd with the suggested gate: if (!ime.isComposing(e) && applyTextareaListBreak(...)) return in the enter-ctrl-newline branch. An IME-owned Ctrl+Enter keeps the base plain-newline path.
Same defect as the GPT finding on this head; the regression test (compositionstart/end, Ctrl+Enter on - a gives - a\n) fails on 5116f1f.

@Pearcekieser
Pearcekieser force-pushed the fix/mobile-enter-list-continuation branch from 5116f1f to ebf05f1 Compare October 1, 2026 20:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): no visible signal that 2. was inserted automatically

rebutted as out of scope: the Watch item rates it low severity and names the two escapes the change already ships, Return on the empty item and one Ctrl+Z that removes only the marker as its own undo step.
This matches #14754's merged behaviour in the Lexical editor and the markdown-editor convention the reviewer cites. A visible hint would be a new UI surface this fix does not need.

The list continuation from kirodotdev#14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
@Pearcekieser
Pearcekieser force-pushed the fix/mobile-enter-list-continuation branch from ebf05f1 to 0367cf0 Compare October 2, 2026 00:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto current main with no code change (ebf05f1 -> 0367cf0), to rerun Backend Tests (Windows) (3). Its only failure on ebf05f1 was test/test_session_export.py::test_a_sent_export_streams_its_staged_file_and_removes_it, a known Windows flake; this PR changes no Python. GPT, Opus, Design and First Principles had no open findings on ebf05f1.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 2, 2026

@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.

Approved: PR Readiness green on this head, merges cleanly into current main, no outstanding blocking review.

@bolichen97
bolichen97 merged commit e858043 into kirodotdev:main Oct 2, 2026
100 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 2, 2026
@Pearcekieser
Pearcekieser deleted the fix/mobile-enter-list-continuation branch October 2, 2026 05:27
iamwhatever pushed a commit that referenced this pull request Oct 2, 2026
…every send mode and the default textarea (#16071)

Adds five cases to ChatInput.listContinuation.test.tsx that #15911's suite left to a local probe: a new line over a selection keeps the native break, Shift+Enter continues the list in ctrl-enter and enter-ctrl-newline modes, plain Enter still sends in enter-ctrl-newline, and the default composer renders the textarea rather than the Lexical editor.
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.

2 participants