Skip to content

feat: useShortcut composable for managing keyboard shortcuts#516

Merged
surajshetty3416 merged 9 commits intodevelopfrom
refactor-shortcuts
Mar 12, 2026
Merged

feat: useShortcut composable for managing keyboard shortcuts#516
surajshetty3416 merged 9 commits intodevelopfrom
refactor-shortcuts

Conversation

@surajshetty3416
Copy link
Copy Markdown
Member

@surajshetty3416 surajshetty3416 commented Mar 12, 2026

  • Added useShortcut composable for managing keyboard shortcuts
    With this the goal is to maintain a single source of truth for all shortcuts and get the list of all registered and active shortcuts in the current view
  • Added a modal to show active shortcuts in current view on hitting "?"
Screenshot 2026-03-12 at 12 22 07 PM Screenshot 2026-03-12 at 12 38 20 PM

With this the goal is to maintain a single source of truth for all shortcuts and get the list of all registered and active shortcuts in the current view
- and add keyboadShortcutsModal to show all active shortcuts in Editor on hitting "?"
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.11%. Comparing base (d59164a) to head (3dcba42).
⚠️ Report is 86 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #516   +/-   ##
========================================
  Coverage    63.11%   63.11%           
========================================
  Files           27       27           
  Lines         2749     2749           
========================================
  Hits          1735     1735           
  Misses        1014     1014           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@surajshetty3416 surajshetty3416 marked this pull request as ready for review March 12, 2026 07:41
@surajshetty3416 surajshetty3416 merged commit 1071add into develop Mar 12, 2026
9 checks passed
NagariaHussain added a commit to BuildWithHussain/hive that referenced this pull request Mar 25, 2026
Replicate the approach from frappe/builder#516: a single useShortcut
hook that registers both the keyboard handler AND adds it to a live
global registry. The shortcuts dialog now reads from this registry
automatically, showing only shortcuts active on the current page.

Before: shortcuts defined in two places (shortcut-registry.ts for
display, use-hotkey.ts hooks for behavior) — could get out of sync.
After: single source of truth per shortcut definition.

Key changes:
- New useShortcut hook with support for single keys, modifier combos
  (Ctrl/Cmd), and two-key chords (e.g. "g d")
- ShortcutHelpDialog reads live from useActiveShortcuts() instead of
  static registry — shows context-aware shortcuts per page
- Migrated all shortcuts: AppLayout (global + navigation),
  ProjectDetailPage (tab switching), TaskDetailSheet (save/assign/pin)
- Removed react-hotkeys-hook dependency (no longer imported)

Files changed:
- frontend/src/hooks/useShortcut.ts (new)
- frontend/src/components/ShortcutHelpDialog.tsx
- frontend/src/components/layout/AppLayout.tsx
- frontend/src/pages/ProjectDetailPage.tsx
- frontend/src/components/TaskDetailSheet.tsx
- frontend/src/hooks/use-hotkey.ts (deleted)
- frontend/src/hooks/useCommandPalette.ts (deleted)
- frontend/src/lib/shortcut-registry.ts (deleted)

Co-Authored-By: NagariaHussain <34810212+NagariaHussain@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.23.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant