Skip to content

fix(web): add Shift+Enter to send messages on iPadOS#209

Merged
tiann merged 1 commit intotiann:mainfrom
VictorNanka:fix/shift-enter-send
Feb 25, 2026
Merged

fix(web): add Shift+Enter to send messages on iPadOS#209
tiann merged 1 commit intotiann:mainfrom
VictorNanka:fix/shift-enter-send

Conversation

@VictorNanka
Copy link
Contributor

Summary

  • Adds Shift+Enter as a keyboard shortcut to send messages, fixing the inability to send via keyboard on iPadOS with a hardware keyboard (Add shift+enter shortcut to send message #175)
  • Preserves existing desktop behavior (Enter still sends) — no breaking changes
  • PR feat: shift+enter sends #178 attempted this fix on the stale dev branch; this applies the correct approach to main

What changed

In HappyComposer.tsx:

  • Added a Shift+Enter keydown handler that calls api.composer().send() when canSend is true
  • Placed before the autocomplete suggestion handler so it fires even when suggestions are open
  • Added canSend and api to the useCallback dependency array

Why PR #178 didn't work

  1. It was merged into the dev branch which is stuck at v0.7.3 — never reached main (v0.15.2)
  2. It changed submitOnEnter to false everywhere, breaking desktop Enter-to-send behavior

Behavior after this fix

Platform Enter Shift+Enter
Desktop Sends (unchanged) Sends (new)
iPadOS + keyboard Newline (unchanged) Sends (fixes #175)
Touch (no keyboard) Newline (unchanged) N/A (use send button)

Test plan

  • Desktop: Enter still sends messages
  • Desktop: Shift+Enter also sends messages
  • Desktop with autocomplete open: Enter selects suggestion, Shift+Enter sends
  • iPadOS with hardware keyboard: Shift+Enter sends messages
  • IME (CJK) input: no interference during composition
  • Empty input: Shift+Enter does nothing when canSend is false

Closes #175

🤖 Generated with Claude Code

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 tiann#175

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings\n- None.\n\nSummary\n- No issues found in the diff. Residual risk: platform-specific key handling (iPadOS hardware keyboard, IME composition) relies on manual verification.\n\nTesting\n- Not run (automation). Suggested: desktop Enter/Shift+Enter, autocomplete open, iPadOS hardware keyboard, IME composition, empty input.\n\nHAPI Bot

@tiann tiann merged commit 467fb54 into tiann:main Feb 25, 2026
2 checks passed
kvinwang added a commit to kvinwang/hapi that referenced this pull request Feb 27, 2026
Remove the Shift+Enter send handler added in tiann#209, which intercepted
Shift+Enter on all platforms and prevented desktop users from inserting
newlines. Desktop keeps Enter=send/Shift+Enter=newline; touch keeps
Enter=newline with send button.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add shift+enter shortcut to send message

2 participants