Skip to content

Make Enter insert newline on virtual keyboards#10

Merged
emilhauk merged 1 commit intomasterfrom
virtual-keyboard-enter-newline
Mar 22, 2026
Merged

Make Enter insert newline on virtual keyboards#10
emilhauk merged 1 commit intomasterfrom
virtual-keyboard-enter-newline

Conversation

@emilhauk
Copy link
Copy Markdown
Owner

Summary

  • On touch/virtual keyboards, Enter now inserts a newline instead of submitting — users tap the Send/Save button instead
  • Physical keyboard behavior unchanged: Enter sends, Shift+Enter newlines
  • Detection uses pointer: coarse media query + pointerdown event override for hybrid devices (e.g. tablet with Bluetooth keyboard)
  • Adds enterkeyhint="send" to message and edit textareas for better virtual keyboard UX

Test plan

  • Desktop browser: Enter sends message, Shift+Enter inserts newline (unchanged)
  • Mobile/touch device: Enter inserts newline, tap Send button to submit
  • Tablet with BT keyboard + mouse: after clicking textarea with mouse, Enter sends
  • Edit form: same behavior for both input modes
  • 4 new E2E browser tests cover physical/virtual × send/edit matrix

🤖 Generated with Claude Code

On touch devices the Enter key now inserts a newline instead of submitting,
forcing mobile users to tap the Send/Save button. Physical keyboard users
keep the existing behavior (Enter sends, Shift+Enter newlines).

Detection uses `pointer: coarse` media query as the default, with
pointerdown events on textareas to dynamically override when the user
switches input methods (e.g. tablet with Bluetooth keyboard).

Also adds `enterkeyhint="send"` to both message and edit textareas so
virtual keyboards label the Enter key accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@emilhauk emilhauk force-pushed the virtual-keyboard-enter-newline branch from cbea9a9 to dc42dea Compare March 19, 2026 22:17
@emilhauk emilhauk merged commit 8ce75f3 into master Mar 22, 2026
4 checks passed
@emilhauk emilhauk deleted the virtual-keyboard-enter-newline branch March 22, 2026 12:46
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.

1 participant