Skip to content

feat(composer): Ctrl+Enter / Cmd+Enter sends the open draft#344

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:feat/composer-cmd-enter-send
Open

feat(composer): Ctrl+Enter / Cmd+Enter sends the open draft#344
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:feat/composer-cmd-enter-send

Conversation

@shukiv
Copy link
Copy Markdown
Contributor

@shukiv shukiv commented May 26, 2026

Closes #343.

Summary

Adds the universal "send-with-platform-modifier" keyboard shortcut every mainstream mail client supports: `Ctrl+Enter` on Windows/Linux, `Cmd+Enter` on macOS. The shortcut routes through the existing `handleSend` path, so attachment warnings, draft-save, undo-send and all other validation flows continue to apply unchanged.

What changed

  • `components/email/email-composer.tsx` — new window-level keydown listener registered while the composer is mounted. Routes through a ref so per-render rebinds of `handleSend` don't re-register the listener.
  • `hooks/use-keyboard-shortcuts.ts` — adds the entry to `KEYBOARD_SHORTCUTS.composer` so the dialog lists it.
  • `locales/en/common.json` — adds the new translation key.

Behaviour rules

Keys Effect
Plain `Enter` in body / chip input unchanged (newline / commit chip)
`Ctrl + Enter` (Win/Linux) send
`Cmd + Enter` (macOS) send
`Shift/Alt + Ctrl/Cmd + Enter` ignored (lets existing chord patterns through)

Test plan

  • Compose -> type body -> `Ctrl+Enter` -> goes to Outbox.
  • `Cmd+Enter` on macOS Safari/Chrome -> same.
  • Cc/Bcc autocomplete -> arrow + Enter still picks suggestion (no modifier, listener bails).
  • Subject input focused + `Ctrl+Enter` -> sends.
  • Body `Enter` without modifier -> newline.
  • Send Failure (toast shown) -> shortcut can be retried.

Notes

Locale strings are added for `en` only. Other languages fall back to the English key via next-intl's default chain until translators get to it.

Adds the universal "send with the platform modifier" shortcut every
mainstream mail client (Gmail, Outlook, Apple Mail, Proton, Tutanota,
Fastmail, Thunderbird) supports. Closes bulwarkmail#343.

Behaviour:

* Window-level keydown listener registered while the composer is
  mounted. Fires when focus is anywhere inside the composer — chip
  inputs, subject, body textarea, or the rich-text contentEditable.
* Plain Enter is untouched; only Enter + Ctrl (Win/Linux) or Cmd
  (macOS) triggers send. Shift/Alt modifiers are ignored so existing
  autocomplete-confirm / chip-commit Enters are not hijacked.
* Routes through a ref so handleSend's per-render rebind doesn't
  re-register the listener every render.
* All existing send-time validation, attachment-warning, draft-save
  and undo-send flows still apply — the shortcut just calls the
  same handleSend() as the toolbar button.
* Listed in the Keyboard Shortcuts dialog under the existing
  Composer section.

Tested:

* Compose -> type body -> Ctrl+Enter -> Outbox.
* Cc/Bcc autocomplete suggestion + Enter still selects (alt-free
  Enter without Ctrl, so the new listener bails).
* Subject input -> Ctrl+Enter -> sends.
* Body Enter without modifier -> newline.
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.

Feature: Ctrl+Enter (Cmd+Enter on macOS) to send mail from the composer

1 participant