Skip to content

feat: add keyboard shortcuts to mail view#2000

Open
JASSBR wants to merge 3 commits intoelie222:mainfrom
JASSBR:feat/mail-keyboard-shortcuts
Open

feat: add keyboard shortcuts to mail view#2000
JASSBR wants to merge 3 commits intoelie222:mainfrom
JASSBR:feat/mail-keyboard-shortcuts

Conversation

@JASSBR
Copy link

@JASSBR JASSBR commented Mar 24, 2026

Summary

  • Added keyboard shortcuts to the mail view following existing patterns from the reply tracker
  • R — opens reply form on the current email
  • E — archives the current email
  • Arrow Up/Down — navigates between emails in the list
  • Shortcuts are disabled when focus is in an input/textarea/contenteditable
  • Created useMailKeyboardNavigation hook wrapping useTableKeyboardNavigation

Test plan

  • Open the mail view
  • Press Arrow Down/Up to navigate between emails
  • Press R to open reply form on selected email
  • Press E to archive selected email
  • Verify shortcuts don't fire when typing in an input field

Fixes #343

Add R (reply), E (archive), and arrow key navigation shortcuts
to the mail view, following existing patterns from the reply tracker.

Fixes elie222#343
@vercel
Copy link

vercel bot commented Mar 24, 2026

@JASSBR is attempting to deploy a commit to the Inbox Zero OSS Program Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/web/components/email-list/EmailList.tsx">

<violation number="1" location="apps/web/components/email-list/EmailList.tsx:459">
P2: Selection-sync effect duplicates mark-read/refetch work and can retrigger on `threads` updates, causing repeated unnecessary queue/API operations.</violation>
</file>

<file name="apps/web/components/email-list/EmailMessage.tsx">

<violation number="1" location="apps/web/components/email-list/EmailMessage.tsx:66">
P2: Global `mail:reply` handling is unscoped, so one keyboard reply event can open reply in multiple expanded messages.</violation>
</file>

<file name="apps/web/hooks/useMailKeyboardNavigation.ts">

<violation number="1" location="apps/web/hooks/useMailKeyboardNavigation.ts:17">
P2: Keyboard shortcuts for reply/archive can fire on modified key combos because modifier state is not filtered before action dispatch.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}: UseMailKeyboardNavigationOptions) {
const handleKeyAction = useCallback(
(index: number, key: string) => {
if (key === "r" || key === "R") {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

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

P2: Keyboard shortcuts for reply/archive can fire on modified key combos because modifier state is not filtered before action dispatch.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/hooks/useMailKeyboardNavigation.ts, line 17:

<comment>Keyboard shortcuts for reply/archive can fire on modified key combos because modifier state is not filtered before action dispatch.</comment>

<file context>
@@ -0,0 +1,30 @@
+}: UseMailKeyboardNavigationOptions) {
+  const handleKeyAction = useCallback(
+    (index: number, key: string) => {
+      if (key === "r" || key === "R") {
+        onReply(index);
+      } else if (key === "e" || key === "E") {
</file context>
Fix with Cubic

- Filter modifier keys (Ctrl/Cmd/Alt) before dispatching key actions
- Scope mail:reply event to specific threadId to prevent opening reply
  in multiple expanded messages
- Guard selection-sync effect to only fire on actual index changes,
  preventing unnecessary mark-read/refetch on threads updates
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/web/components/email-list/EmailList.tsx">

<violation number="1" location="apps/web/components/email-list/EmailList.tsx:320">
P2: Selection sync effect now skips thread-list updates when index is unchanged, which can leave opened thread/read state stale after refresh/reorder/removal.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Prevents stale state when threads reorder/refresh under the same index.
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.

Mail: Add keyboard shortcuts

2 participants