Issue with handling of shortcut keys for MenuBar

In our application, we use the menu bar component to display the menu.
We add shortcut keys to open the appropriate menu item.

It works … but with one condition : The application needs to have the focus.

For example, if I add the shortcut key “CTRL+SHFT+A” to a menu entry point, two behaviors :

  • If the application has the focus, it works correctly
  • If the application does not have the focus (but the browser has), then the shortcut key is handled by the browser itself. This behavior occurs for Firefox and Chrome (not on IE 8+ !!)

I think the problem is that the application does not get the focus when a new screen is displayed.
If a click on the application, launch a shortcut, the appropriate screen is displayed.
If, without touching to the application, I immediately launch a new shortcut, then it is managed by the browser.

So, is there a way to force the focus on the application instead of having it on the browser ?

Thanks in advance

Regards

Pierre

Nobody already has the same issue ?

Hi Pierre,

i had the same problem like you and i was able to fix it using the focus() method on any component of the application:

firstButtonInMenuBar.focus();

That worked for me.

Kind regards,

Andreas