shortcut: get keyboard event / actual target #256
-
Hey! I am using shortcut for handling several user actions. I bind all handlers on |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@moklick hmm, I see. thank you for the question.
How do you feel about an additional function onShortcut(event) {
if (event.detail.originalEvent.target.tagName === 'INPUT') {
...
}
} |
Beta Was this translation helpful? Give feedback.
@moklick hmm, I see. thank you for the question.
shortcut
is aCustomEvent
, whosetarget
is whatever node the Svelte action is placed on, so the observed behavior makes sense. For your use case we need to access the originalKeyboardEvent
object, which is not exposed in the current version.How do you feel about an additional
originalEvent
in theevent.detail
object, something like this: