W vd L
W vd L

Reputation: 625

Richfaces: menu key binding

I got a richface issue that rather looks very easy, but i can't find the answer. I want to acces a (dropdown)menu with keybindings. Once the menu has focus i can use the arrow buttons without a problem. I just cant get the 'focus' on my menu with a hotkey

XHTML:

<rich:dropDownMenu  
      binding="#{menuBarBean.menuBar}" 
      id="main-menu" 
      showEvent="mouseup" 
      onclick="showMenu();" 
      />


<rich:hotKey enabledInInput="true" key="ctrl+M" onkeyup="displayMenu()" preventDefault="true" />

JavaScript:

function displayMenu(){
  #{rich:component('main-menu')}.show();
  **// Do something that sets focus on the richface menu component**
}

In short: How to get the focus on

#{rich:component('main-menu')}

with:

<rich:hotKey />

Upvotes: 0

Views: 172

Answers (1)

Makhiel
Makhiel

Reputation: 3884

jQuery has a .focus() method that focuses things:

#{rich:component('main-menu')}.element.focus();

Upvotes: 1

Related Questions