Click Shortcuts only work after click into browser window / page

i use this code to set shortcuts:

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.

My problem is reproducable by the vaadin 6 sampler demo app. Steps to reproduce:

  1. open http://demo.vaadin.com/sampler-for-vaadin6#Shortcuts
  2. pick the “Shortcuts, scope” example
  3. try the short cut " ALT-SHIFT-1 to focus the left panel → it does not work (for me anyway, firefox and chrome)
  4. click anywhere in the browser page → shortcut starts to work

However, if you navigate to the example via the menu link on the left side, the shortcut works immediately.

I cannot observe the problem in the vaadin 7 sampler demo. Note that i am using vaadin 7, though.

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.