opened
pleku
username_0
The API should allow handling keyboard events, including usage of modifier keys, simply from Java API of the component. Should look into declaring a mixin interface that adds the API to the component, and a static way of adding handlers to any component.

@marcushellberg has an add-on for this for V10 https://vaadin.com/directory/component/shortcut/overview which does the same.
Spike: Prototyping an API for adding keyboard shortcuts to any component
issue
created
bogdanudrescu
username_1
`ComponentUtil.addListener(... eventType=KeyPressEvent.class ...)` or any other `KeyboardEvent` eventTypes already works and shortcut filtering may be achieved on the server side.

In case we need it on the client side we need to use a similar approach as in https://github.com/marcushellberg/shortcut, though the API used there is at Element level, and beside the filter we need to send also `event.preventDefault();` and `event.stopPropagation();`.

Considering that we need the event at `Component` level we may need at least another `ComponentUtil` method specifically designed for `KeyboardEvent`s, preferably reusing the same listener type.
comment
created
ujoni
username_2
I made a small demo for an approach that registers all shortcuts on the body of the page: [shortcut2](https://github.com/username_2/shortcuts2). It is build on the addon implementation and does not touch anything in the flow (for now).

I listed some potential problems with this approach into the README and I am sure there are others.
comment
closed
pleku
username_0
issue