feat: useShortcut composable for managing keyboard shortcuts#516
Merged
surajshetty3416 merged 9 commits intodevelopfrom Mar 12, 2026
Merged
feat: useShortcut composable for managing keyboard shortcuts#516surajshetty3416 merged 9 commits intodevelopfrom
surajshetty3416 merged 9 commits intodevelopfrom
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This used to conflict with canvas move
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>
|
🎉 This PR is included in version 1.23.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
useShortcutcomposable for managing keyboard shortcutsWith 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