From: Martin Vysny Date: Thu, 3 Dec 2020 04:16:58 +0000 (+0200) Subject: MenuBar: Don't set openRootOnHover when on Android or IOS. (#12135) X-Git-Tag: 7.7.23~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c734ae92dbe03e616ea926c0cc24f6173173450;p=vaadin-framework.git MenuBar: Don't set openRootOnHover when on Android or IOS. (#12135) Fixes #5873 --- 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();