private boolean openRootOnHover;
+ /*
+ * Flag to disable first root item selection when clicking on the menubar
+ * (tabbing to the menubar should select the first item)
+ */
+ private boolean preventFocusSelection = false;
+
public VMenuBar() {
// Create an empty horizontal menubar
this(false, null);
while (parent.getParentMenu() != null) {
parent = parent.getParentMenu();
}
+ preventFocusSelection = true;
parent.setFocus(true);
}
while (parent.getParentMenu() != null) {
parent = parent.getParentMenu();
}
+ preventFocusSelection = true;
parent.setFocus(true);
}
}
* @param item
*/
public void itemOver(CustomMenuItem item) {
+ preventFocusSelection = true;
if ((openRootOnHover || subMenu || menuVisible) && !item.isSeparator()) {
+ preventFocusSelection = true;
setSelected(item);
if (!subMenu && openRootOnHover && !menuVisible) {
menuVisible = true; // start opening menus
* .dom.client.FocusEvent)
*/
public void onFocus(FocusEvent event) {
+ if (!preventFocusSelection) {
+ setSelected(items.get(0));
+ }
+ preventFocusSelection = false;
+ }
+ @Override
+ public void setFocus(boolean focus) {
+ super.setFocus(focus);
+ if (!focus) {
+ setSelected(null);
+ preventFocusSelection = false;
+ }
}
private final String SUBPART_PREFIX = "item";