Skip to content

fix(web): keep held Enter from changing restored prompts - #47036

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
peakoshi:t3/pr1-web-fix
Dec 1, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
peakoshi:t3/pr1-web-fix

Conversation

@peakoshi

@peakoshi peakoshi commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Holding Enter to restore a stashed prompt closes the stash menu on the first keydown, and subsequent auto-repeat Enter keydowns reach the composer editor and insert extra blank lines into the restored draft.

Steps to reproduce (no sign-in required):

  1. Start vp run dev --no-seed, open the local app, and start a Replay (dev) thread.
  2. Type Keep this saved draft exactly. in the composer and press Ctrl+S (Windows/Linux) or Cmd+S (macOS) to stash it.
  3. Click the stash badge (Stashed prompts: 1) with the composer focused, then hold Enter until it repeats (or send three Enter keydowns before keyup, e.g., keyboard.down("Enter"), wait for the stash menu to close, keyboard.down("Enter"), keyboard.up("Enter")).
  4. Expected: the restored draft stays Keep this saved draft exactly. with no extra lines. Actual on main: the repeated Enter events insert blank lines into the restored draft.

Change

Generalize the existing suppressHeldBackspace guard in ComposerStashMenu.tsx (added in #46506) into suppressHeldKey("Backspace" | "Enter", composerForm), ignore repeated Enter keydowns while the stash is still open, and also abort the temporary window listener on window blur.

Scope

Small fix for an obvious keyboard interaction bug, so no separate issue. Touches only ComposerStashMenu.tsx and its browser test in apps/web (shared by web and desktop renderers). Does not change product defaults, modifier-Enter handling, or submit behavior.

Verification

  • vp test run apps/web/src/components/chat/ComposerStashMenu.browser.test.tsx -t "leaves modified Enter and arrows in the composer alone while the stash is open" failed on main (20a0e5f388): {Enter>3/} inserted two extra newlines into the restored draft.
  • vp test run apps/web/src/components/chat/ComposerStashMenu.browser.test.tsx passed 8/8 Chromium browser tests on d3f99b9041, confirming held Enter restores cleanly and a fresh Enter after release still adds a newline.
  • vp fmt, vp lint, and vp run knip:check passed on d3f99b9041; vp run check:changed passed on the pre-rebase head (14 tests) with clean git status.
  • Verified in the live local Replay (dev) web app (desktop and mobile widths, light and dark themes). Not checked: native desktop shell, iOS, and Android.
Before (main) After (fix)

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 1, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d3f99b9

Macroscope's review found this PR approvable — Prevents held Enter from continuing to affect a restored prompt, extending the existing Backspace safeguard. The change is confined to composer keyboard handling with cleanup on release, fresh press, or window blur.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The stash menu now suppresses held Enter and modified-Backspace keys. Repeated Enter events do not trigger another restoration. A browser test checks that a later Enter inserts a newline.

Changes: Composer stash key handling

Layer / File(s) Summary
Held-key suppression and stash restoration
apps/web/src/components/chat/ComposerStashMenu.tsx, apps/web/src/components/chat/ComposerStashMenu.browser.test.tsx
The menu generalizes held-key suppression to Enter and Backspace. It aborts listeners on keyup, a fresh press, or window blur. Repeated Enter events return before restoring the highlighted entry. The browser test checks that three Enter presses restore the first prompt, then a further Enter inserts a newline.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: stienswout, only21mil

Merge Risk: Minimal · up to 65b90

Holding Enter to restore a stashed prompt should no longer add blank lines to the restored draft, and a fresh Enter after release still adds a newline. The change is small and confined to the stash menu, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): keep held Enter from changing restored prompts" matches the main change. The changeset generalizes the held-key guard to cover Enter and ignores repeated Enter keydowns while the …
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives reproduction steps and expected and actual behavior. The Change section explai…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(web): keep held Enter from changing restored prompts" matches the main change. The changeset generalizes the held-key guard to cover Enter and ignores repeated Enter keydowns while the stash menu is open, so held Enter no longer adds blank lines to a restored prompt. It uses a conventional commit format and plain language.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives reproduction steps and expected and actual behavior. The Change section explains the generalized suppressHeldKey guard and the window blur abort. The Scope section links no issue but explains why none is needed for a small keyboard bug. The Verification section lists focused test runs with results, lists the checks not performed, and includes before and after screenshots. The author did not state which agent or model did the work, which the template asks for when an agent was used. The description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d3f99b9 and 65b905b.

Files selected for processing: 2

  • apps/web/src/components/chat/ComposerStashMenu.browser.test.tsx
  • apps/web/src/components/chat/ComposerStashMenu.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 1, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

On each fresh New thread with Replay (dev) / Showcase: type “Keep this saved draft exactly.”, press Ctrl+S, focus the composer, open Stash 1, send one Enter keydown plus 25 repeated keydowns, then keyup. Scroll the composer to its top for capture. On head, press Enter again after release and verify the prompt is submitted.

Environment: real web dev app in Chromium, 1280×800, light theme, fresh isolated databases and synthetic project on both commits.

Scenario: Held Enter restores a saved prompt without adding blank paragraphs

Proven: the scenario fails on base 2b7b085254 and passes on head 65b905b0a6.

Base 2b7b085254 Head 65b905b0a6
Result ❌ failed
ASSERTION_FAILED: expected {"text":"Keep this saved draft exactly.","paragraphs":26} to equal {"text":"Keep this saved draft exactly.","paragraphs":1}
✅ passed
held enter restored prompt Base 2b7b085254: held enter restored prompt Head 65b905b0a6: held enter restored prompt
failure Base 2b7b085254: failure
fresh enter after release Head 65b905b0a6: fresh enter after release
Recording Before: held Enter After: held Enter and fresh Enter after release

Scenario source

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 1, 2026
@juliusmarminge
juliusmarminge merged commit af3c88c into pingdotgg:main Dec 1, 2026
30 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants