From 1c734ae92dbe03e616ea926c0cc24f6173173450 Mon Sep 17 00:00:00 2001 From: Martin Vysny Date: Thu, 3 Dec 2020 06:16:58 +0200 Subject: [PATCH] MenuBar: Don't set openRootOnHover when on Android or IOS. (#12135) Fixes #5873 --- .../vaadin/client/ui/menubar/MenuBarConnector.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java index f739d16fe4..43f6dcc52d 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -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(); -- 2.39.5