aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSauli Tähkäpää <sauli@vaadin.com>2015-03-13 22:29:59 +0200
committerVaadin Code Review <review@vaadin.com>2015-07-15 07:13:53 +0000
commit0e085a9ddbf75b7052d521ade84cd08c986e3469 (patch)
tree5bdb5a21e2923553724b47db9b858bd36660f8eb
parentef79e1aa98b6460e43bfc63672b862513c1e9404 (diff)
downloadvaadin-framework-0e085a9ddbf75b7052d521ade84cd08c986e3469.tar.gz
vaadin-framework-0e085a9ddbf75b7052d521ade84cd08c986e3469.zip
Increase Tooltip z-index to be larger than the default overlay z-index. (#14854)
Change-Id: Ib6a2f77aadc9cb1afe8a8e43be9916de3d2eaf44
-rw-r--r--client/src/com/vaadin/client/VTooltip.java3
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java34
-rw-r--r--uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java46
3 files changed, 83 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 4e59040298..f3d65cd20a 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -89,6 +89,9 @@ public class VTooltip extends VOverlay {
LiveValue.ASSERTIVE);
Roles.getTooltipRole().setAriaRelevantProperty(getElement(),
RelevantValue.ADDITIONS);
+
+ // Tooltip needs to be on top of other VOverlay elements.
+ setZIndex(VOverlay.Z_INDEX + 1);
}
/**
diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java
new file mode 100644
index 0000000000..ff470336f5
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltip.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.tooltip;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.MenuBar;
+
+public class MenuBarTooltip extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ MenuBar menubar = new MenuBar();
+
+ MenuBar.MenuItem menuitem = menubar.addItem("Menu item", null, null);
+ menuitem.setDescription("Menu item description");
+
+ MenuBar.MenuItem submenuitem1 = menuitem.addItem("Submenu item 1", null, null);
+ submenuitem1.setDescription("Submenu item 1 description");
+
+ MenuBar.MenuItem submenuitem2 = menuitem.addItem("Submenu item 2", null, null);
+ submenuitem2.setDescription("Submenu item 2 description");
+
+ addComponent(menubar);
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14854;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "MenuItem tooltip should have a larger z-index than MenuBar/MenuItem.";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java
new file mode 100644
index 0000000000..9b2f7d13d6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tooltip/MenuBarTooltipTest.java
@@ -0,0 +1,46 @@
+package com.vaadin.tests.tooltip;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.ui.themes.ChameleonTheme;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
+import com.vaadin.ui.themes.ValoTheme;
+
+public class MenuBarTooltipTest extends MultiBrowserTest {
+
+ @Test
+ public void toolTipShouldBeOnTopOfMenuItem() {
+ String[] themes = new String[] {
+ ValoTheme.THEME_NAME,
+ Reindeer.THEME_NAME,
+ Runo.THEME_NAME,
+ ChameleonTheme.THEME_NAME
+ };
+
+ for(String theme : themes) {
+ assertZIndices(theme);
+ }
+ }
+
+ public void assertZIndices(String theme) {
+ openTestURL("theme=" + theme);
+
+ $(MenuBarElement.class).first().clickItem("Menu item");
+
+ assertThat(String.format("Invalid z-index for theme %s.", theme),
+ getZIndex("v-tooltip"), greaterThan(getZIndex("v-menubar-popup")));
+ }
+
+ private int getZIndex(String className) {
+ return Integer.parseInt(
+ findElement(By.className(className)).getCssValue("z-index"));
+ }
+
+} \ No newline at end of file