I have a navigation bar that is just a GWT MenuBar component which has other MenuBars with their own MenuItems. Just like http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwMenuBar
GWT MenuBar opens the cascade menu bar when you hover over it (provided you have .setAutoOpen(true)). I would like to create the effect that the menu closes when you stop hovering (because I find it annoying that the menu remains open just because I accidentally hovered over it, for example).
I have read as much as I have been able to find on Google. I tried doing something like
myMenuBar.addHandler(new BlurHandler() {
@Override
public void onBlur(BlurEvent event) {
myMenuBar.closeAllChildren(true);
}
}, BlurEvent.getType());
(onBlur should be the opposite to onFocus) only to discover that the MenuBar loses focus when I hover over its children (so I can't select anything, because the main MenuBar loses focus and it closes, making the navigation bar useless), but annoyingly, it wont lose focus if I hover anywhere else (top, sides, etc., probably because there are no other components there to steal the focus), leaving the cascade menu open.
I tried using .setFocusOnHoverEnabled(false), but without focus I can't know when I'm not hovering over the MenuBar or its MenuItems.
I am starting to think I can't actually override this behavior with the GWT MenuBar (A menu in JavaScript could behave this way, closing the cascade menu when you stop hovering over it, but since GWT is writing that JS code for me, I guess that the price to pay is that it will behave that way...), so, please any advice about either how to do this with GWT or to confirm it is not possible is appreciated.