From 817906332a8ba99e8a711067c10282b8cd9a6415 Mon Sep 17 00:00:00 2001 From: Alexey Fansky Date: Thu, 9 Apr 2015 11:09:15 -0700 Subject: [PATCH] Adding a temporary style to VNotification on Chrome >=41 (#17252) Change-Id: I41c05e8f8487d351035804e0681947956d861479 --- .../com/vaadin/client/ui/VNotification.java | 9 ++++- .../ChromeBottomNotification.java | 33 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java index d7639b0022..eee0f459a6 100644 --- a/client/src/com/vaadin/client/ui/VNotification.java +++ b/client/src/com/vaadin/client/ui/VNotification.java @@ -257,12 +257,19 @@ public class VNotification extends VOverlay { /** * Android 4 fails to render notifications correctly without a little * nudge (#8551) + * Chrome 41 now requires this too (#17252) */ - if (BrowserInfo.get().isAndroid()) { + if (BrowserInfo.get().isAndroid() + || isChrome41OrHigher()) { WidgetUtil.setStyleTemporarily(getElement(), "display", "none"); } } + private boolean isChrome41OrHigher() { + return BrowserInfo.get().isChrome() + && BrowserInfo.get().getBrowserMajorVersion() >= 41; + } + protected void hideAfterDelay() { if (delay == null) { delay = new Timer() { diff --git a/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java b/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java new file mode 100644 index 0000000000..0fdc8df360 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java @@ -0,0 +1,33 @@ +package com.vaadin.tests.components.notification; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.Position; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Notification; + +public class ChromeBottomNotification extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + addButton("Show notification", new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + Notification notification = new Notification( + "Hello world", + Notification.Type.ERROR_MESSAGE); + notification.setPosition(Position.BOTTOM_CENTER); + notification.show(getPage()); + } + }); + } + + @Override + protected Integer getTicketNumber() { + return 17252; + } + + @Override + public String getDescription() { + return "Bottom notification on Chrome goes up to top"; + } +} -- 2.39.5