Resolve #265 regarding shortcuts in certain input fields.

As we want other shortcuts do work in input fields (which couldn't in previous releases).
This commit is contained in:
the-djmaze 2022-03-04 14:43:58 +01:00
parent 54f48fbe4d
commit a503329b77
5 changed files with 35 additions and 28 deletions

View file

@ -32,6 +32,11 @@ export const
fireEvent = (name, detail) => dispatchEvent(new CustomEvent(name, {detail:detail})),
formFieldFocused = () => doc.activeElement && doc.activeElement.matches('input,textarea'),
registerShortcut = (keys, modifiers, scopes, method) =>
shortcuts.add(keys, modifiers, scopes, () => formFieldFocused() ? true : method()),
addEventsListener = (element, events, fn, options) =>
events.forEach(event => element.addEventListener(event, fn, options)),