feat(web): configurable composer send key#2393
feat(web): configurable composer send key#2393jappyjan wants to merge 1 commit intopingdotgg:mainfrom
Conversation
📝 WalkthroughWalkthroughA new configurable composer send key setting is implemented across the application layers. The feature allows users to choose between three options: Enter, Shift+Enter, or button-only sending. Changes include adding the setting schema definition, updating the keyboard event handler to respect the configured key, and adding UI controls in the settings panel. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/components/settings/SettingsPanels.tsx`:
- Around line 1019-1066: The global restore logic is not detecting changes to
the new composerSendKey setting; update useSettingsRestore to include
"composerSendKey" in the changedSettingLabels array so that changedSettingLabels
(and the early-return check) will detect this setting as dirty; locate the
useSettingsRestore implementation and add "composerSendKey" alongside the other
setting keys referenced in changedSettingLabels so restores and
SettingResetButton behavior work correctly with SettingsPanels' composerSendKey
control.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4ac44262-17b6-4038-8177-709620aae3f1
📒 Files selected for processing (3)
apps/web/src/components/chat/ChatComposer.tsxapps/web/src/components/settings/SettingsPanels.tsxpackages/contracts/src/settings.ts
| <SettingsRow | ||
| title="Composer send key" | ||
| description="Choose which keystroke submits the composer. Use 'Send button only' on touch devices to avoid accidental sends from the soft keyboard's Enter." | ||
| resetAction={ | ||
| settings.composerSendKey !== DEFAULT_UNIFIED_SETTINGS.composerSendKey ? ( | ||
| <SettingResetButton | ||
| label="composer send key" | ||
| onClick={() => | ||
| updateSettings({ | ||
| composerSendKey: DEFAULT_UNIFIED_SETTINGS.composerSendKey, | ||
| }) | ||
| } | ||
| /> | ||
| ) : null | ||
| } | ||
| control={ | ||
| <Select | ||
| value={settings.composerSendKey} | ||
| onValueChange={(value) => { | ||
| if (value === "enter" || value === "shift-enter" || value === "button-only") { | ||
| updateSettings({ composerSendKey: value }); | ||
| } | ||
| }} | ||
| > | ||
| <SelectTrigger className="w-full sm:w-44" aria-label="Composer send key"> | ||
| <SelectValue> | ||
| {settings.composerSendKey === "shift-enter" | ||
| ? "Shift + Enter" | ||
| : settings.composerSendKey === "button-only" | ||
| ? "Send button only" | ||
| : "Enter"} | ||
| </SelectValue> | ||
| </SelectTrigger> | ||
| <SelectPopup align="end" alignItemWithTrigger={false}> | ||
| <SelectItem hideIndicator value="enter"> | ||
| Enter | ||
| </SelectItem> | ||
| <SelectItem hideIndicator value="shift-enter"> | ||
| Shift + Enter | ||
| </SelectItem> | ||
| <SelectItem hideIndicator value="button-only"> | ||
| Send button only | ||
| </SelectItem> | ||
| </SelectPopup> | ||
| </Select> | ||
| } | ||
| /> | ||
|
|
There was a problem hiding this comment.
Add composerSendKey to global restore-dirty tracking.
The new setting is configurable here, but useSettingsRestore does not include it in changedSettingLabels. If this is the only modified setting, global restore can no-op because of the early return at Line [512].
Suggested patch
diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
@@
...(settings.defaultThreadEnvMode !== DEFAULT_UNIFIED_SETTINGS.defaultThreadEnvMode
? ["New thread mode"]
: []),
+ ...(settings.composerSendKey !== DEFAULT_UNIFIED_SETTINGS.composerSendKey
+ ? ["Composer send key"]
+ : []),
...(settings.addProjectBaseDirectory !== DEFAULT_UNIFIED_SETTINGS.addProjectBaseDirectory
? ["Add project base directory"]
: []),
@@
settings.defaultThreadEnvMode,
+ settings.composerSendKey,
settings.diffWordWrap,
settings.enableAssistantStreaming,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web/src/components/settings/SettingsPanels.tsx` around lines 1019 -
1066, The global restore logic is not detecting changes to the new
composerSendKey setting; update useSettingsRestore to include "composerSendKey"
in the changedSettingLabels array so that changedSettingLabels (and the
early-return check) will detect this setting as dirty; locate the
useSettingsRestore implementation and add "composerSendKey" alongside the other
setting keys referenced in changedSettingLabels so restores and
SettingResetButton behavior work correctly with SettingsPanels' composerSendKey
control.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b980ee. Configure here.
ApprovabilityVerdict: Approved Self-contained user preference feature adding configurable composer send key options. Default behavior preserved, schema-validated input, and the concern raised in the review comment appears already addressed in the current diff. You can customize Macroscope's approvability policy. Learn more. |
Add a "Composer send key" setting (server-synced via UnifiedSettings) with three options: - "Enter" (default, current behavior): Enter sends, Shift+Enter newlines - "Shift + Enter": Shift+Enter sends, Enter newlines - "Send button only": neither key sends, only the dedicated send button The default preserves existing desktop behavior. "Send button only" is intended for touch devices where the soft keyboard's Enter key otherwise sends partial messages on every tap. The slash-command/ mention menu's Enter-to-confirm path is unchanged because the menu branch fires before the send branch. UI lives in the existing General settings panel, between "New threads" and "Add project starts in", as a Select control matching the established settings-row pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9b980ee to
cdcf825
Compare

Summary
Add a "Composer send key" setting (server-synced via `UnifiedSettings`) with three options:
Why
On a phone the soft keyboard's Enter key sends partial messages on every tap, which is wrong for a touch UX. "Send button only" fixes that without forcing one heuristic on everyone — vim/editor users may prefer "Shift + Enter" on desktop, etc.
The default preserves existing desktop behavior, so this is an additive change with no migration concerns. The slash-command / mention menu's Enter-to-confirm path is unchanged — the menu branch fires before the send branch in `onComposerCommandKey`.
Files
Test plan
Screenshots / video
Note
Add configurable send key option to the chat composer
composerSendKeysetting with three options:enter(default),shift-enter, orbutton-only, replacing the hardcoded Enter-to-send behavior in ChatComposer.tsx.'enter') to settings.ts, including support for partial patch updates.Macroscope summarized cdcf825.
Note
Medium Risk
Changes message-submission key handling in
ChatComposer, which can impact UX and prevent/trigger unintended sends, but is gated by a new setting with a default matching prior behavior.Overview
Adds a new server-synced
composerSendKeysetting (defaultenter) with options for Enter, Shift+Enter, or Send button only, including schema/defaults and patch support.Exposes this preference in the General settings panel with a select control, reset support, and inclusion in the “restore defaults” dirty-check list.
Updates
ChatComposerkey handling soonSendfires only when the configured send keystroke is pressed, while leaving menu selection (Enter/Tab) behavior unchanged.Reviewed by Cursor Bugbot for commit cdcf825. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit