diff --git a/src/shortcuts/core.ts b/src/shortcuts/core.ts index 86b4ad0b52a..4a6c7f88a48 100644 --- a/src/shortcuts/core.ts +++ b/src/shortcuts/core.ts @@ -218,9 +218,11 @@ class Shortcuts { !(element instanceof HTMLElement) || key == null || element.matches(this.ALLOW_SHORTCUTS_SELECTOR) || - (element.dataset.enabledShortcuts != null - ? element.dataset.enabledShortcuts.split(',').includes(key) - : element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null) + element.closest(this.ALLOW_SHORTCUTS_SELECTOR) != null || + ( + element.dataset.enabledShortcuts != null && + element.dataset.enabledShortcuts.split(',').includes(key) + ) ) { return false; }