mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
fix(input): handle Cmd+D when TextInput has focus
Prevents browser bookmark dialog from appearing when using Cmd+D to toggle dictation while typing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -351,11 +351,23 @@ export function MessageInput({
|
||||
|
||||
const shouldHandleDesktopSubmit = IS_WEB;
|
||||
|
||||
function handleDesktopSubmitKeyPress(event: WebTextInputKeyPressEvent) {
|
||||
function handleDesktopKeyPress(event: WebTextInputKeyPressEvent) {
|
||||
if (!shouldHandleDesktopSubmit) return;
|
||||
if (event.nativeEvent.key !== "Enter") return;
|
||||
const { shiftKey, metaKey, ctrlKey } = event.nativeEvent;
|
||||
|
||||
// Cmd+D or Ctrl+D: toggle dictation
|
||||
if ((metaKey || ctrlKey) && event.nativeEvent.key === "d") {
|
||||
event.preventDefault();
|
||||
if (isDictating) {
|
||||
cancelDictation();
|
||||
} else {
|
||||
startDictation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.nativeEvent.key !== "Enter") return;
|
||||
|
||||
// Shift+Enter: add newline (default behavior, don't intercept)
|
||||
if (shiftKey) return;
|
||||
|
||||
@@ -436,7 +448,7 @@ export function MessageInput({
|
||||
onContentSizeChange={handleContentSizeChange}
|
||||
editable={!isDictating && isConnected && !disabled}
|
||||
onKeyPress={
|
||||
shouldHandleDesktopSubmit ? handleDesktopSubmitKeyPress : undefined
|
||||
shouldHandleDesktopSubmit ? handleDesktopKeyPress : undefined
|
||||
}
|
||||
autoFocus={IS_WEB && autoFocus}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user