]> source.dussan.org Git - vaadin-framework.git/commitdiff
Adding a temporary style to VNotification on Chrome >=41 (#17252)
authorAlexey Fansky <alexey.fansky@effective-soft.com>
Thu, 9 Apr 2015 18:09:15 +0000 (11:09 -0700)
committerVaadin Code Review <review@vaadin.com>
Fri, 10 Apr 2015 12:23:10 +0000 (12:23 +0000)
Change-Id: I41c05e8f8487d351035804e0681947956d861479

client/src/com/vaadin/client/ui/VNotification.java
uitest/src/com/vaadin/tests/components/notification/ChromeBottomNotification.java [new file with mode: 0644]

index d7639b002229cc821ce917bdac273ab2cd7e19b6..eee0f459a6541b59e31e77244f668d15d159a1a0 100644 (file)
@@ -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 (file)
index 0000000..0fdc8df
--- /dev/null
@@ -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";
+    }
+}