You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): arrowing through a draft no longer opens composer suggestions - #36142
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.
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)
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
… 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>
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.
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
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
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
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:M30-99 changed lines (additions + deletions).takeover:needs-juliusTakeover done; route gate says Julius decidesvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Moving the caret through a draft opens the composer's suggestion list whenever the caret stops right after
/command,$skill,@fileor#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-activedescendanton 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.
One visible difference for mouse users: clicking into an existing
@fileor#12no 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:
main.#to start a heading still opens the pull request list until the space is typed.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,/planand@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./modab, then ArrowLeft ×3 onto/modaria-activedescendantset!/mod! ab: ArrowDown went to the list/mod ab!/mod ab, ArrowLeft ×3, Shift+Enter/modis replaced by the highlighted command/modAfter only. The before run did not get this far, because the Shift+Enter step selected
/modeland derailed the rest of the run:see #12 x, then ArrowLeft ×2 onto#12: the list stays closed./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
/modelleaves the list closed, and typing a letter there opens it.Screenshots. The composer after typing
/model aband pressing ArrowLeft three times. Web dev build, headless Chromium, 1280×800, light theme, cropped to the composer.main(4aec277f79b)Screen reader. Checked by hand with NVDA in a Chromium-based browser, on the web dev build of d027ac4. All passed:
/model aband pressing Left three times, no list is announced. Down then!gives/model ab!.#12insee #12 and more, Shift+Enter adds a new line.$mid-sentence opens the skills list, and Escape closes it.vp run check:changedpasses.Not checked:
main. It was run on this branch only.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