mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
feat(ui): improve keyboard shortcuts discoverability and centralized management
This commit is contained in:
parent
b581b4f86c
commit
d7a2f4a515
9 changed files with 233 additions and 39 deletions
47
artifacts/2026-02-22/centralized_keyboard_shortcuts.md
Normal file
47
artifacts/2026-02-22/centralized_keyboard_shortcuts.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Centralizing Keyboard Shortcuts
|
||||
|
||||
**Date:** 2026-02-22
|
||||
|
||||
## Objective
|
||||
Centralize the definitions of all keyboard shortcuts into a single configuration file (`client/plugins/constants.js`). Currently, hotkeys are scattered across various components (e.g., `Appbar.vue`, `ContextMenuDropdown.vue`, `ShortcutsModal.vue`), with hardcoded keys like `Ctrl+K`, `Alt+H`, etc.
|
||||
|
||||
## Proposed Strategy
|
||||
1. **Extend `$hotkeys` in `client/plugins/constants.js`:**
|
||||
Add a new section `App` or `Global` and `Batch` to store the exact combination of keys for each action.
|
||||
Example:
|
||||
```javascript
|
||||
const hotkeys = {
|
||||
// ... existings ones ...
|
||||
Global: {
|
||||
Home: 'Alt-H',
|
||||
Library: 'Alt-L',
|
||||
Series: 'Alt-S',
|
||||
Collections: 'Alt-C',
|
||||
Authors: 'Alt-A',
|
||||
ShortcutsHelper: 'Shift-/'
|
||||
},
|
||||
Batch: {
|
||||
SelectAll: 'Ctrl-A',
|
||||
Consolidate: 'Ctrl-K',
|
||||
Merge: 'Ctrl-M',
|
||||
MoveToLibrary: 'Alt-M',
|
||||
ResetMetadata: 'Alt-R',
|
||||
QuickMatch: 'Alt-Q',
|
||||
Cancel: 'Escape'
|
||||
},
|
||||
ItemView: {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **Refactor Event Listeners:**
|
||||
Modify `handleKeyDown` in `Appbar.vue` and `keyDown` in `default.vue` to check against these constants instead of relying on hardcoded `e.key` checks. They can use the existing `this.getHotkeyName(e)` (which returns format `Ctrl-K` or `Alt-K`) from `default.vue`.
|
||||
|
||||
3. **Refactor Visual Components:**
|
||||
Components like `ContextMenuDropdown.vue` and `ShortcutsModal.vue` should import or use `this.$hotkeys` mapping to display the combination in the UI, rendering the exact combination so if it changes in `constants.js`, it updates automatically everywhere.
|
||||
|
||||
## Expected Outcome
|
||||
- Easier to manage and modify shortcuts in the future.
|
||||
- Reduced risk of conflicts.
|
||||
- A single source of truth for the codebase and documentation.
|
||||
|
|
@ -23,6 +23,7 @@ This index provides a quick reference for specification and documentation files
|
|||
| **2026-02-17** | [ui_enhancements.md](2026-02-17/ui_enhancements.md) | Specification for "View All" shortcuts on Home view shelves with specific sorting. |
|
||||
| **2026-02-20** | [promote_file_to_book.md](2026-02-20/promote_file_to_book.md) | Specification for "promoting" files from an existing book into a standalone library item, including a "Split Book" wizard. |
|
||||
| **2026-02-20** | [move_to_library_keyboard_shortcuts.md](2026-02-20/move_to_library_keyboard_shortcuts.md) | Specification for keyboard-shortcut-enabled library buttons in the "Move to Library" dialog. |
|
||||
| **2026-02-22** | [centralized_keyboard_shortcuts.md](2026-02-22/centralized_keyboard_shortcuts.md) | Specification for centralizing keyboard shortcut definitions into a single configuration file. |
|
||||
| **General** | [docs/consolidate_feature.md](docs/consolidate_feature.md) | Comprehensive documentation for the "Consolidate" feature, including conflict resolution and technical details. |
|
||||
| **General** | [docs/item_restructuring_guide.md](docs/item_restructuring_guide.md) | Guide for Moving, Merging, and Splitting (Promoting) library items. |
|
||||
| **General** | [docs/metadata_management_tools.md](docs/metadata_management_tools.md) | Documentation for Reset Metadata and Batch Reset operations. |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue