feat: add keyboard shortcuts to mail view#2000
Conversation
Add R (reply), E (archive), and arrow key navigation shortcuts to the mail view, following existing patterns from the reply tracker. Fixes elie222#343
|
@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. |
|
|
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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>
- 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
There was a problem hiding this comment.
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.
Summary
useMailKeyboardNavigationhook wrappinguseTableKeyboardNavigationTest plan
Fixes #343