Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep the composer open while selecting timeline text #9499

Mergedjuliusmarmingemerged 1 commit intofix/composer-paste-expands fromrefs/pull/9499/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Raised on #7855 with a video: drag-selecting an assistant response while the composer is expanded makes the Cite button flash and vanish. The selection blurs the composer, the composer rests, the timeline reflows under it, and the selection toolbar dismisses on that scroll.

The blur check now holds while a non-collapsed selection lives inside the timeline, and a selectionchange listener re-runs it once the selection clears (click elsewhere, Escape, or using Cite). The rest still happens; it just waits until the user is done with the text. Desktop only; the phone collapse is focus-driven and unaffected.

Stacked on #9498 (paste-to-focus); this layer's diff is independent of it.

Before

Drag-select with the composer expanded: composer rests (84px), no Cite button.

before

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4239771dd51fcfde/before-select.mp4

After

Composer stays expanded through the selection, Cite is usable, and the citation lands in the draft. Once the selection clears the composer rests as before.

Selection heldCite used
after selectafter cite

https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4a53b1968522ead9/after-select.mp4

Verification

  • vp test run on the new composerSelectionHold.test.ts (4 passing).
  • tsgo --noEmit in web, lint clean on the touched files.
  • Manual pass in the web app: held at 178px with Cite visible → clear selection → rests at 84px.

Claude Fable 5 via Claude Code.

🤖 Generated with Claude Code

Note

Keep ChatComposer open while selecting timeline text on desktop

  • Adds selectionHoldsComposerOpen predicate that returns true only for a non-collapsed selection whose range ancestor is inside the timeline node
  • Updates the desktop blur/collapse check in ChatComposer.tsx to skip clearing focus while a timeline selection is active, and adds a selectionchange listener that schedules a collapse check when the selection ends
  • Adds unit tests in composerSelectionHold.test.ts covering active, collapsed, external, empty, and missing-node cases
  • Behavioral Change: mobile is excluded from both new paths; desktop composer will no longer auto-collapse during an active timeline selection
Macroscope summarized 4557997.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—13.7 KiB—15.1 KiB✅
      CodexThread snapshot wire—7.0 KiB—7.3 KiB✅
      CodexLive turn WebSocket wire—6.7 KiB—7.8 KiB✅
      CodexLive turn WebSocket decoded—58.5 KiB—66.4 KiB✅
      CodexLive turn messages—10—21✅
      ClaudeTotal thread wire—13.6 KiB—15.1 KiB✅
      ClaudeThread snapshot wire—7.0 KiB—7.3 KiB✅
      ClaudeLive turn WebSocket wire—6.6 KiB—7.8 KiB✅
      ClaudeLive turn WebSocket decoded—57.9 KiB—66.4 KiB✅
      ClaudeLive turn messages—10—21✅

      Baseline: unavailable · PR result: 4557997 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

      Fix All in Cursor Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot), but a cloud agent failed to start. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4557997a01c6af375598d8b97c293045a1f8b5fb. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -4298,0 +4312,21 @@
      4312+ let wasHolding = false;
      4313+ const handleSelectionChange = () => {
      4314+ const holding = selectionHoldsComposerOpen(
      4315+ window.getSelection(),
      4316+ getTimelineScrollableNode(),
      4317+ );
      4318+ if (wasHolding && !holding) {
      4319+ scheduleComposerCollapseCheck();
      4320+ }
      4321+ wasHolding = holding;
      4322+ };
      4323+ document.addEventListener("selectionchange", handleSelectionChange);
      4324+ return () => {
      4325+ document.removeEventListener("selectionchange", handleSelectionChange);
      4326+ };
      4327+ }, [
      4328+ getTimelineScrollableNode,
      4329+ isComposerFocused,
      4330+ isMobileViewport,
      4331+ scheduleComposerCollapseCheck,
      4332+ ]);

      Focus-in bypasses selection hold

      Medium Severity

      The new timeline-selection hold only gates scheduleComposerCollapseCheck. Desktop focusin still calls setIsComposerFocused(false) as soon as focus leaves the composer. Tabbing to the portaled Cite control therefore rests the composer, reflows the timeline, and can dismiss the toolbar this change is meant to keep usable.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4557997a01c6af375598d8b97c293045a1f8b5fb. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This focused desktop UI fix changes composer collapse behavior during timeline text selection, but the focus-management path still has a plausible route that can dismiss the composer while the selection toolbar is in use. Human validation is warranted for the complete selection and focus interaction.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this522ebe6

    6. juliusmarminge closed this

Sign in to join this conversation.