Ignore hotkeys with modifiers
Avoids unintentionally triggering when using system shortcuts like `command+[` in macOS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user