fix(web): add Shift+Enter keyboard shortcut to send messages (#209)

On iPadOS with a hardware keyboard, `isTouch` is true (via pointer:coarse)
so submitOnEnter is disabled and there's no keyboard-based way to send.

Add Shift+Enter as a send shortcut that works on all platforms without
changing existing behavior — desktop Enter-to-send is preserved.

Closes #175

via [HAPI](https://hapi.run)

Co-authored-by: HAPI <noreply@hapi.run>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kexiang Shan
2026-02-25 16:57:40 +08:00
committed by GitHub
co-authored by HAPI Claude Opus 4.6
parent 10f7e1404e
commit 467fb54231
@@ -258,6 +258,15 @@ export function HappyComposer(props: {
return
}
// Shift+Enter sends the message (works on all platforms including iPadOS with keyboard)
if (key === 'Enter' && e.shiftKey) {
e.preventDefault()
if (!canSend) return
api.composer().send()
setShowContinueHint(false)
return
}
if (suggestions.length > 0) {
if (key === 'ArrowUp') {
e.preventDefault()
@@ -308,6 +317,8 @@ export function HappyComposer(props: {
onPermissionModeChange,
permissionMode,
permissionModes,
canSend,
api,
haptic
])