<af:commandtoolbarbutton accesskey="o" action="OpenDetails" text="Open" />
The accessKey must be a single character and in firefox, in order to use the access key you have to hit Alt+Shift+o.
What if you want to use an accelerator key for other types of keystrokes? Menu Items are the only component that supports accelerator keys so for example to add a hot key for CTRL+0 you would need to add a menu item somewhere on the page
<af:commandMenuItem action="OpenDetails" accelerator="ctrl 0" />
A menu item needs to hang inside a af:menu and af:menu needs to hang inside a menuBar so if you only want to use the accelerator feature without displaying a menu you will need to hide the menu container (menuBar).
using inlineStyle="display:none". Now have the menu item perform the same action as the button and you have just created an accelerator key stroke for your button.
Oracle Documentation on Accelerator Keys
Great tip! thanks.
ReplyDelete