Skip to content

Commit be64e5e

Browse files
fix(app): mark prompt submit/newline commands disabled
Per Copilot review on anomalyco#23430: registering the commands with their default Enter / Shift+Enter keybinds put them in the global command keymap. When focus was on a non-editable target (a <button>, etc.) the global handler would match, call preventDefault/stopPropagation, and invoke the undefined onSelect \u2014 silently swallowing Enter across the whole app. `disabled: true` excludes them from `keymap()` build in context/command.tsx while the catalog, options, and settings UI still list them (none of those code paths filter by disabled). Local dispatch in prompt-input.tsx is unaffected because handleKeyDown reads keybinds directly from `settings.keybinds`, not from the registered command option.
1 parent 48752ac commit be64e5e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/app/src/components/prompt-input.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,24 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
127127
// the Keyboard Shortcuts settings UI (grouped under "Prompt" via the
128128
// "prompt." id prefix). The actual dispatch stays local in handleKeyDown
129129
// below so the editor always wins over the global keymap.
130+
//
131+
// `disabled: true` excludes these from the global keymap in context/command
132+
// so a focused non-editable target (e.g. a <button>) pressing Enter isn't
133+
// silently swallowed by the global handler. The catalog entries remain
134+
// visible in settings-keybinds.tsx because catalog population doesn't
135+
// filter by disabled.
130136
command.register(() => [
131137
{
132138
id: PROMPT_SUBMIT_ID,
133139
title: language.t("command.prompt.submit"),
134140
keybind: DEFAULT_PROMPT_SUBMIT_KEYBIND,
141+
disabled: true,
135142
},
136143
{
137144
id: PROMPT_NEWLINE_ID,
138145
title: language.t("command.prompt.newline"),
139146
keybind: DEFAULT_PROMPT_NEWLINE_KEYBIND,
147+
disabled: true,
140148
},
141149
])
142150

0 commit comments

Comments
 (0)