refactor(shortcut): Use declarative data attributes for keyboard shortcuts

Instead of having JavaScript code guess which elements exist on a page,
elements now declare their keyboard shortcuts via data-global-keyboard-shortcut
attribute. This makes it easier to add new shortcuts and follows Gitea's
existing patterns for data-global-init and data-global-click.
This commit is contained in:
micahkepe
2026-02-14 22:43:52 -08:00
committed by Micah Kepe
parent 7226ecde9a
commit 663612cdab
5 changed files with 91 additions and 138 deletions
+1
View File
@@ -150,6 +150,7 @@ watch([searchQuery, filteredFiles], async () => {
<input
ref="searchInput" :placeholder="placeholder" autocomplete="off"
role="combobox" aria-autocomplete="list" :aria-expanded="searchQuery ? 'true' : 'false'"
data-global-keyboard-shortcut="t"
@input="handleSearchInput" @keydown="handleKeyDown"
@focus="isInputFocused = true" @blur="isInputFocused = false"
>