I have a Vaadin Flow combo box that I’d like to get focus every time a shortcut key is pressed (Vaadin 12.0.0). I’ve tried the following in my page’s main VerticalLayout, but it has no effect:
Shortcut.add(this, Key.of("f"), () -> {
searchCombo.focus(); // breakpoint here is never hit
}, Key.ALT, Key.SHIFT);
The following works, but only if the combo already has focus:
Shortcut.add(this, Key.ENTER, () -> {
searchCombo.focus(); // breakpoint hit here
});
The fact that Enter works but other keystrokes don’t suggests to me that there’s some key event filtering happening (combos act on the Enter keystroke by default).
Is there something more that needs to be done to enable this plugin?