Skip to content

Add keyboard shortcuts for navigation and thread actions ⌨️ - #61

Merged
maneesha-xyz merged 3 commits into
OpenGovMail:mainfrom
sanjaiyan-dev:sanjaiyan-hotkeys
Nov 17, 2026
Merged

maneesha-xyz merged 3 commits into
OpenGovMail:mainfrom
sanjaiyan-dev:sanjaiyan-hotkeys

Conversation

@sanjaiyan-dev

Copy link
Copy Markdown
Contributor

Summary

Introduces keyboard shortcuts across the application powered by @tanstack/react-hotkeys.

Power users and high-volume email handlers often rely on keyboard navigation for speed and efficiency. To provide a familiar and seamless experience, these shortcuts adopt industry-standard keybindings used in modern email clients like Gmail (e.g., C to compose, G then I to navigate, R/A/F for thread actions).


Key Shortcuts Added

🌐 Global Navigation (App.tsx)

Shortcut Action Destination
C Compose new email /compose
G then I Go to Inbox /inbox
G then P Go to Profile /profile
G then L Go to Login /login

Note: Route updates are wrapped in startTransition to keep transitions non-blocking and smooth.

✉️ Thread Actions (ThreadPage.tsx)

Shortcut Action Guard
R Reply Only when reply modal is closed
A Reply All Only when reply modal is closed
F Forward Only when reply modal is closed

Implementation Details

  • Dependency: Added @tanstack/react-hotkeys for lightweight, reliable sequence and combo listening.
  • Input Guarding: Configured options: { enabled: !isModalOpen } on thread actions so keystrokes do not trigger background actions while drafting a message.
  • Standards Alignment: Follows desktop client conventions to reduce friction for operators managing official government correspondence.

How to Test

  1. Global Navigation:
    • From any page, press C to confirm it navigates to /compose.
    • Press G then I to return to /inbox.
    • Press G then P to navigate to /profile.
  2. Thread Actions:
    • Open any thread on ThreadPage.
    • Press R → verifies reply modal opens.
    • Close modal and press A → verifies Reply All opens.
    • Close modal and press F → verifies Forward opens.
    • While the modal is open, test typing letters (R, A, F) in the body/input fields to verify shortcuts remain disabled while typing.

- Introduced a new HotKeys component to handle keyboard shortcuts.
- Implemented shortcuts for navigating to login, inbox, profile, and compose pages.
- Utilized startTransition for smoother navigation transitions.
@maneesha-xyz
maneesha-xyz self-requested a review November 11, 2026 03:57

@maneesha-xyz maneesha-xyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@maneesha-xyz

Copy link
Copy Markdown
Member

@sanjaiyan-dev can you resolve the conflicts. This PR can be merged.

- Updated ProfileForm to utilize react-hook-form with zod for schema validation, improving form handling and error management.
- Refactored RegistrationForm to implement react-hook-form and zod, enhancing validation and state management.
- Adjusted LoginPage and RegisterPage to handle form submissions with typed data.
- Improved MessageBubble error handling for better readability.
- Enhanced MessageGroup key generation for unique identification of messages.
- Optimized ComposePage recipient parsing logic for better performance.
- Updated MailPage to integrate mini-search for improved email thread searching.
- Fixed sidebar resizing logic and added keyboard accessibility.
- Updated Vite configuration to enable React compiler options.
@sanjaiyan-dev

Copy link
Copy Markdown
Contributor Author

@maneesha-xyz Thanks for the approval! The merge conflicts are now resolved—ready to merge.

@maneesha-xyz
maneesha-xyz merged commit ae99ba9 into OpenGovMail:main Nov 17, 2026
4 checks passed
@sanjaiyan-dev
sanjaiyan-dev deleted the sanjaiyan-hotkeys branch November 17, 2026 04:55
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.

2 participants