Repository navigation
fix(composer): double-click expands a paste chip in the Lexical composer - #23153
Conversation
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing a screenshot of the Lexical paste chip before and after double-click, and a recording of it expanding. No image was admitted, so the blind read was not performed. Evidence gaps
[UX-REVIEWED] 5453f38 Description read[DESCRIPTION-READ] 75cd83e028655f8c3d3a73a4fda7f3686b594e2e9c747ab825f1fc0d25eecad1 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this gives the Lexical chip back the double-click gesture the textarea composer already has, and the paste blocks are derived from the nodes, so the expanded block drops out of the sidecar without extra code. Notes
[DESIGN-REVIEWED] 5453f38 Description read[DESCRIPTION-READ] 0481999ee312cacc577dfc3256287616c4e255e70613ebeba733ef9758e7f63b 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The double-click expand fixes the defect reported in #23148 at the cause: the Lexical chip never had the handler. The read-only click guard comes along with it, and the description declares it. What this change shipsInventory (4 items) — 3 justifiedIntent: a user can double-click a collapsed paste in the Lexical composer to expand it back to the full text, as the textarea composer already allows. FIX.
[FIRST-PRINCIPLES-REVIEWED] 5453f38 Description read[DESCRIPTION-READ] b4383caeaef88401a0585b61a43345e2f1de65c86244dd54f53c28602ecdb422 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
7815d9f to
0f3b969
Compare
0f3b969 to
f27740f
Compare
|
|
self-added: yes
|
f27740f to
c8100c4
Compare
c8100c4 to
657f38d
Compare
|
self-added: yes
|
657f38d to
da873ab
Compare
|
Rebased once onto main for the #23264 Windows fix. |
bolichen97
left a comment
There was a problem hiding this comment.
HOLD
The read-only double-click test dispatches only dblclick, but a real browser sends two click events first. Each click reaches onClick and calls editor.update before the double-click editable guard runs. The test therefore does not prove the stated read-only boundary.
Use the real double-click event sequence, or userEvent.dblClick, and assert the content and paste blocks remain unchanged. If read-only clicks must not change selection or preview state, guard onClick too.
da873ab to
5453f38
Compare
|
@bolichen97 Thanks, you were right. Addressed in 5453f38 (no rebase; the branch is not in conflict).
Re-requested your review. |
bolichen97
left a comment
There was a problem hiding this comment.
Good to ship. Head reviewed: 5453f38.
My earlier change request is resolved on this head. The read-only test now uses userEvent.dblClick, so it sends click, click, dblclick. The onClick handler now skips the selection update while the editor is read-only.
What I verified locally at this head:
src/test/LexicalComposerInput.test.tsxpasses (49 tests).- With the new
editor.isEditable()guard inonClickremoved, the read-only test fails. The test pins the guard. - With the expand test switched to
userEvent.dblClickin an editable editor, the chip still expands. The two preceding clicks do not interfere. $expandPasteTokenNodehandles empty content, a trailing newline and a final text node, and puts the caret after the inserted text.appendPlainTextmoved unchanged, and the draft loader still calls it.- The linked issue is tier:T1. No file is on the security path list. Main has not changed the three touched files since this branch's base.
Note, not blocking: the screenshot and recording links in the description are local file paths, so they do not render on GitHub. Upload them as attachments if you want the UX lane to read them.
Remaining gate: PR Readiness is still running on this head. I will approve after it reports passed.
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 5453f38.
My earlier change request is resolved on this head: the read-only test uses userEvent.dblClick and the onClick handler skips the selection update while the editor is read-only.
Gates checked on this head: readiness label is passed, PR Readiness is green, no check is failing or pending, the Opus, GPT, Design and First Principles lanes report no blocking findings, there is no merge conflict, the base is main, and the linked issue is tier:T1. No touched file is on the security path list.
Problem / Motivation
Goal: double-clicking a collapsed paste in the composer expands it to the full pasted text again, whichever composer engine is in use.
A user reports that since the latest update, double-clicking a collapsed paste (
Paste #1 · N lines) in the composer does nothing. With Settings > Chat > Style Markdown While Typing on, the composer is the Lexical engine, and its paste chip can only be selected, previewed or deleted. It cannot be expanded.Why it matters
Expanding a paste in place is how a user checks or trims a large paste before sending it. Turning on a styling preference silently removes that gesture, and the preview tooltip still says "Double-click to insert the full text" (#22782), so the UI promises something it does not do.
Not a goal
What changed (motivation → approach → change)
Symptom → cause: #15031 (6765454, in 0.9.0) made Style Markdown While Typing also switch
ChatInputonto the Lexical composer. The textarea composer expands a paste ondetail >= 2(handleTextareaClickinwebsite/src/chat-core/composer/pasteEditor.ts), but the Lexical paste chip never had an equivalent. Before #15031 no user-reachable setting led to that engine, so the gap did not show.Change: in
website/src/components/PasteTokenNode.tsx, the chip now handlesonDoubleClick. The handler closes the preview, then calls a new$expandPasteTokenNodethat replaces the node with the block's text and puts the caret after it. The text-to-nodes split (one text node per line, line breaks between) is the composer's existingappendPlainText, moved fromwebsite/src/components/LexicalComposerInput.tsxintoPasteTokenNode.tsxand exported, so the draft loader and the expand share one implementation. The composer derives its paste blocks from the nodes, so the expanded block drops out of the sidecar on its own, the same way the textarea path drops it. While the editor is read-only (Optimize running), neither click handler touches the editor:onDoubleClickdoes nothing, andonClickstill toggles the preview but no longer selects the chip. A real double-click sends twoclickevents beforedblclick, so both guards are needed for the gesture to leave the draft alone and not make the optimizer throw its rewrite away.Backwards compatibility
Compatible: the only addition is a double-click handler on the chip;
appendPlainTextmoves files with identical behaviour. Single click, keyboard, copy/cut, delete and draft loading behave as before.Removes nothing: the chip gains a gesture and every existing path stays.
Tests
website/src/test/LexicalComposerInput.test.tsx:expands a paste chip to its full text on double-click and drops the block: the value becomes the surrounding text plus the full content, the chip is gone, and the blocks are[]. It fails with thePasteTokenNode.tsxchange reverted (verified locally) and passes with it.does not change the editor on a real double-click while read-only: the editor is made read-only, thenuserEvent.dblClicksends the browser's click, click, dblclick sequence to the chip. It asserts noeditor.updatecall, an unchanged value, unchanged paste blocks, and the chip still present. It fails without theonClickguard (the two clicks each calleditor.update).a single click on a paste chip still only selects it, never expands: guards the select-first single click.Determinism: the whole file (49 tests) passed shuffled runs with
--sequence.shuffle. Neither test uses timers or randomness.Local gates:
npx vitest run src/test/LexicalComposerInput.test.tsxgreen;tsc -p tsconfig.app.jsonclean; eslint clean on both files; semgrep--config semgrep/clean on both files. On this host,scripts/local-gate.py's cross-surface backend batch shows 62 failures and 15 errors (PlatformCompositionError: the host resolves anenterpriseprofile). The same set fails on the unmodified base, so it is environmental, not this diff. CI is the authority on the backend suites.Manual verification
Captured in a browser (see Screenshots / video): a real double-click on the Lexical chip expands it in place. The unit tests drive the same component through
fireEvent.doubleClick.Screenshots / video
Real
LexicalComposerInput(dark theme, inline markdown on) mounted in an isolated capture harness, driven by Playwright Chromium: the chip showsPaste #1 · 6 lines, a double-click replaces it with the pasted traceback, and the paste-block count drops from 1 to 0.Before (collapsed chip):
After double-click (full text inserted in place):
Recording:
Related Issues
Closes #23148
Overlap note: open PR #11100 (fork, conflicting,
needs-author-decision) deletesPasteTokenNode.tsxin favour of new pill nodes. If it lands later, its pills need the same double-click gesture.Sibling sweep
Siblings: none --
PasteTokenChipis the only paste-token editor node in the Lexical composer; the textarea engine already expands viahandleTextareaClick, and the sent-bubblePastedChipis a toggle button, not an editor node.Pattern harvest
Rule candidate: review-prompt
Pattern: "a setting that switches users between two engines of one surface must keep every gesture the other engine honours (the composer engines here)".
Checklist