From d7ef7960925fafae2285024bdd4b2bb95af27a8c Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Thu, 1 Jan 2026 09:47:10 -0600 Subject: [PATCH] Ignore hotkeys with modifiers Avoids unintentionally triggering when using system shortcuts like `command+[` in macOS --- app/javascript/controllers/card_hotkeys_controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/card_hotkeys_controller.js b/app/javascript/controllers/card_hotkeys_controller.js index b2f92ee9b..564c076ad 100644 --- a/app/javascript/controllers/card_hotkeys_controller.js +++ b/app/javascript/controllers/card_hotkeys_controller.js @@ -10,7 +10,7 @@ export default class extends Controller { } handleKeydown(event) { - if (this.#shouldIgnore(event)) return + if (this.#shouldIgnore(event) || this.#hasModifier(event)) return const handler = this.#keyHandlers[event.key.toLowerCase()] if (handler) { @@ -37,6 +37,10 @@ export default class extends Controller { target.closest("input, textarea, [contenteditable], lexxy-editor") } + #hasModifier(event) { + return event.metaKey || event.ctrlKey || event.altKey || event.shiftKey + } + get #selectedCard() { // Find the navigable-list that currently has focus const focusedList = this.navigableListOutlets.find(list => list.hasFocus)