Ignore hotkeys with modifiers

Avoids unintentionally triggering when using system shortcuts like
`command+[` in macOS
This commit is contained in:
Jason Zimdars
2026-01-01 09:47:10 -06:00
parent 0634ddaebd
commit d7ef796092
@@ -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)