historyPreviousButton.addClickListener(e -> actionHistoryPrevious());
historyPreviousButton.setClickShortcut(KeyCode.ARROW_LEFT);
Unfortunately, the keyboard shortcuts only start to work after I click somewhere on the page.
When I call focus() on any button, all shortcuts work, but only once.
I found a workaround. In my view (which is a Panel), I register for MainUI events in the constructor:
MainUi.registerSubscriber(this)
Then I focus the panel on the PostViewChangeEvent:
@Subscribe
public void eventPostViewChange(final PostViewChangeEvent event)
{
focus();
}
Seems to work so far.
Sounds like https://dev.vaadin.com/ticket/19392, i.e. the shortcuts are registered on the UI div. If the focus is not inside the UI div, no shortcuts are triggered.