diff options
-rw-r--r-- | WebContent/VAADIN/themes/base/menubar/menubar.css | 6 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java | 19 |
2 files changed, 23 insertions, 2 deletions
diff --git a/WebContent/VAADIN/themes/base/menubar/menubar.css b/WebContent/VAADIN/themes/base/menubar/menubar.css index 632850ea89..1ce42ce657 100644 --- a/WebContent/VAADIN/themes/base/menubar/menubar.css +++ b/WebContent/VAADIN/themes/base/menubar/menubar.css @@ -72,4 +72,10 @@ .v-menubar .v-icon, .v-menubar-submenu .v-icon { margin-right: 3px; +} + +.v-menubar-popup:focus, +.v-menubar-popup .popupContent:focus, +.v-menubar-popup .popupContent .v-menubar-submenu:focus{ + outline: none; }
\ No newline at end of file diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 6899a2ca9f..4a8ff451ca 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -90,7 +90,6 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, } public VMenuBar(boolean subMenu) { - super(); items = new ArrayList<CustomMenuItem>(); popup = null; @@ -286,7 +285,7 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, public void onMenuClick(int clickedItemId) { // Cancel the focus event handling since focus was gained by // clicking an item. - if (focusDelayTimer != null) { + if (focusDelayTimer != null || subMenu) { focusDelayTimer.cancel(); } @@ -416,6 +415,15 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, if (isEnabled() && targetItem.isEnabled()) { itemClick(targetItem); } + if (subMenu) { + // Prevent moving keyboard focus to child menus + VMenuBar parent = parentMenu; + while (parent.getParentMenu() != null) { + parent = parent.getParentMenu(); + } + parent.setFocus(true); + } + break; case Event.ONMOUSEOVER: @@ -428,6 +436,13 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, itemOut(targetItem); break; } + } else if (subMenu && DOM.eventGetType(e) == Event.ONCLICK && subMenu) { + // Prevent moving keyboard focus to child menus + VMenuBar parent = parentMenu; + while (parent.getParentMenu() != null) { + parent = parent.getParentMenu(); + } + parent.setFocus(true); } } |