Skip to content

fix(web): arrowing through a draft no longer opens composer suggestions - #36142

Open
akj wants to merge 3 commits into
pingdotgg:mainfrom
akj:t3/fix-slash-menu-autocomplete
Open

akj wants to merge 3 commits into
pingdotgg:mainfrom
akj:t3/fix-slash-menu-autocomplete

Conversation

@akj

@akj akj commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Moving the caret through a draft opens the composer's suggestion list whenever the caret stops right after /command, $skill, @file or #12. The open list then takes ArrowUp, ArrowDown, Enter and Tab from the text. Arrowing through a message that is already written can end in a list nobody asked for, and Enter can replace a word with the highlighted suggestion instead of adding a line or sending.

It is worse with a screen reader. Since #10154 the open list sets aria-activedescendant on the editor, so the list is announced and the reading position in the text is lost each time the caret crosses one of these words.

Reproduction on main: type /model ab, press ArrowLeft three times so the caret sits after /model, then press ArrowDown or Shift+Enter.

Change

Suggestions now open only on an edit. A caret move keeps an open list on the word it is open for, or closes it, and never opens one.

  • Typing a trigger still opens the list, including mid-sentence.
  • Moving left and right inside the word being typed keeps the list open and filters it.
  • Moving off the word closes the list. Moving back does not reopen it. Typing or deleting a character in the word does.
  • Escape works as before.

One visible difference for mouse users: clicking into an existing @file or #12 no longer reopens the list, because a click is also a caret move. Editing the word reopens it.

The composer already sends caret moves and edits through the same callback, so the fix tells them apart by whether the text changed. The rule itself is a small pure function in useComposerTriggerState.ts.

Scope

Fixes #36487.

A bug fix: keys meant for the text are taken by a list the user never opened, and Enter can rewrite the draft.

Not in this change:

  • A draft that already ends in a trigger still opens its list when the thread is opened, as on main.
  • In plain-text mode, typing # to start a heading still opens the pull request list until the space is typed.
  • Mobile is unchanged. Its suggestion popover takes no keys, so it cannot take over navigation.

Verification

Unit test. useComposerTriggerState.test.ts: 7 of 7 pass. With the caret rule reverted, 6 of the 7 fail. The cases cover caret moves onto #, #12, $skill, /plan and @src, an open list following the caret, and Escape dismissal.

Real app. Web dev build in headless Chromium at 1100×700, driven with real key presses through Playwright. Before is this branch with the two changed source files as they are on main. After is this branch.

Step Before After
Type /mod List opens List opens
Type ab, then ArrowLeft ×3 onto /mod List reopens, aria-activedescendant set List stays closed
Then ArrowDown and type ! /mod! ab: ArrowDown went to the list /mod ab!
Type /mod ab, ArrowLeft ×3, Shift+Enter /mod is replaced by the highlighted command New line after /mod

After only. The before run did not get this far, because the Shift+Enter step selected /model and derailed the rest of the run:

  • Type see #12 x, then ArrowLeft ×2 onto #12: the list stays closed.
  • Type /model, then ArrowLeft: the list stays open. Home closes it, and End does not reopen it.

A separate run on this branch covered the mouse: clicking into the middle of a typed /model leaves the list closed, and typing a letter there opens it.

Screenshots. The composer after typing /model ab and pressing ArrowLeft three times. Web dev build, headless Chromium, 1280×800, light theme, cropped to the composer.

Before: the two changed files as on main (4aec277f79b) After: d027ac4c49d
Before: the command list is open above the composer although the caret was only moved onto /model After: the same draft and caret position with no list open

Screen reader. Checked by hand with NVDA in a Chromium-based browser, on the web dev build of d027ac4. All passed:

  • After typing /model ab and pressing Left three times, no list is announced. Down then ! gives /model ab!.
  • With the caret moved back to just after #12 in see #12 and more, Shift+Enter adds a new line.
  • Typing a trigger at the end of a line opens its list, and Down moves through it. Home closes it, and End does not reopen it.
  • Typing $ mid-sentence opens the skills list, and Escape closes it.

vp run check:changed passes.

Not checked:

  • JAWS, and the desktop app shell, which wraps the same web composer.
  • The click on main. It was run on this branch only.
  • The step table after the rebase. It was recorded before this branch was rebased onto two server-only commits and was not repeated. The screenshots, the click check and the NVDA pass are on d027ac4.

Reviewed with sol-loop: 1 round with gpt-6.1-sol on xhigh. Sol verdict: approved

Created with Claude Fable 5.2 in T3 Code.

🤖 Generated with Claude Code

… moves

Moving the caret onto `/command`, `$skill`, `@file` or `pingdotgg#12` opened the
suggestion list, which then took the arrow keys, Enter and Tab from the
text. Arrowing through a draft could swap a word for a suggestion.

Suggestions now open only on an edit. A caret move keeps the open list
on its own word or closes it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 13, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d027ac4

Macroscope's review found this PR approvable — Composer suggestions now distinguish editing from caret navigation, preventing an unopened suggestion list from taking navigation keys. The change is limited to suggestion interactions, with reported browser verification covering the affected behavior.

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

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The composer now distinguishes caret movement from text edits when updating trigger state. Trigger state tracks open and dismissed triggers and applies different transitions for edits and caret moves. Tests cover trigger detection, dismissal, and reopening.

Changes: Composer trigger state

Layer / File(s) Summary
Trigger state transitions
apps/web/src/components/chat/useComposerTriggerState.ts, apps/web/src/components/chat/useComposerTriggerState.test.ts
Trigger state helpers and hook behavior distinguish edits from caret movement. Tests cover trigger detection, dismissal, and reopening.
Composer change classification
apps/web/src/components/chat/ChatComposer.tsx
onPromptChange classifies updates as caret movement or text edits and passes the classification to the trigger-state setter for pending-answer and regular prompt paths.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge, t3dotgg

Merge Risk: Minimal · up to be091

Composer suggestions now open on text edits rather than caret moves. The change is limited to the web client, has unit coverage for the transitions, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: composer suggestions no longer open when the caret is moved through a draft. It matches the raw summary, which says caret moves no longer open suggestions, and the lin…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. Problem states the bug and a reproduction on main. Change explains the edit-versus-caret rule and its be…
Linked Issues check Passed Issue #36487 requires that a caret move onto an existing /command, @file, #12 or $skill not open the suggestion list, and that editing the word still opens it. At head be091fa, useComposerTriggerStat…
Out of Scope Changes check Passed The whole-PR diff from the merge base a35fd81 touches the composer trigger path. ChatComposer.tsx adds a triggerChange classification and passes it at the two setComposerTrigger call sites. useCo…
Full details: Title check

Explanation

The title names the main change: composer suggestions no longer open when the caret is moved through a draft. It matches the raw summary, which says caret moves no longer open suggestions, and the linked issue, which asks that caret moves onto triggers not open lists. The title follows the conventional commit form the template asks for.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. Problem states the bug and a reproduction on main. Change explains the edit-versus-caret rule and its behavior. Scope links issue #36487 and lists exclusions. Verification gives unit test counts, a before/after table, screenshots, a screen reader pass, and unchecked items. The template's agent-model line is present. The description is detailed, and some of it is tied to a specific commit and rebase, which the author flags.

Full details: Linked Issues check

Explanation

Issue #36487 requires that a caret move onto an existing /command, @file, #12 or $skill not open the suggestion list, and that editing the word still opens it. At head be091fa, useComposerTriggerState.ts implements this. nextComposerTriggerState opens a candidate only when change is "edit". For "caret", it returns the candidate only if it matches the already-open trigger by kind and rangeStart, so a caret move onto a closed word does not open it. ChatComposer.tsx sets triggerChange to "caret" when nextPrompt equals promptRef.current, and passes it to setComposerTrigger in both the pending-answer path and the regular path. Escape handling stays in the dismissed state. The unit tests in useComposerTriggerState.test.ts cover caret moves onto #, #12, $skill, /plan and @src, and Escape dismissal. The PR reports real-app Playwright runs and an NVDA check on d027ac4; the rebased head was not re-run for the step table. Those runs are reported evidence and were not re-executed here. Non-coding checks (JAWS, desktop shell, manual NVDA) are not coding requirements.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff from the merge base a35fd81 touches the composer trigger path. ChatComposer.tsx adds a triggerChange classification and passes it at the two setComposerTrigger call sites. useComposerTriggerState.ts adds the caret/edit rule and the open/dismissed state. useComposerTriggerState.test.ts adds tests for that rule. Each change supports the issue objective. The PR excludes mobile, plain-text heading, and drafts that already end in a trigger at thread open, and the code changes do not touch those paths. The raw summary reports no exported-declaration changes beyond the trigger helpers, which serve this fix. No unrelated change was found.

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 d027ac4 and be091fa.

Files selected for processing: 2

  • apps/web/src/components/chat/ChatComposer.tsx
  • apps/web/src/components/chat/useComposerTriggerState.test.ts

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

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 14, 2026

This branch has not been deployed

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

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Arrowing onto a /command, @file or #12 in a composer draft opens its suggestion list, which then takes the arrow keys and Enter

2 participants