]> source.dussan.org Git - vaadin-framework.git/commitdiff
MenuBar: Don't set openRootOnHover when on Android or IOS. (#12135)
authorMartin Vysny <martin@vysny.me>
Thu, 3 Dec 2020 04:16:58 +0000 (06:16 +0200)
committerGitHub <noreply@github.com>
Thu, 3 Dec 2020 04:16:58 +0000 (06:16 +0200)
Fixes #5873

client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java

index f739d16fe4d1c2bdc0b2f306d0c49389be002aa0..43f6dcc52deb5b4a478d16404888e4c54b5dd54f 100644 (file)
@@ -23,6 +23,7 @@ import com.google.gwt.dom.client.Element;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.Timer;
 import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.BrowserInfo;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.TooltipInfo;
 import com.vaadin.client.UIDL;
@@ -57,8 +58,14 @@ public class MenuBarConnector extends AbstractComponentConnector
         widget.htmlContentAllowed = uidl
                 .hasAttribute(MenuBarConstants.HTML_CONTENT_ALLOWED);
 
-        widget.openRootOnHover = uidl
-                .getBooleanAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER);
+        if (BrowserInfo.get().isAndroid() || BrowserInfo.get().isIOS()) {
+            // disable the auto-open on hover on devices that don't support hover.
+            // fixes https://github.com/vaadin/framework/issues/5873
+            widget.openRootOnHover = false;
+        } else {
+            widget.openRootOnHover = uidl
+                    .getBooleanAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER);
+        }
 
         widget.enabled = isEnabled();