]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix styling of Window control buttons to show focus (#10285)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Tue, 28 Nov 2017 11:34:00 +0000 (13:34 +0200)
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>
Tue, 28 Nov 2017 11:34:00 +0000 (13:34 +0200)
Fixes #8918

tests/screenshots
themes/src/main/themes/VAADIN/themes/valo/components/_window.scss
uitest/src/main/java/com/vaadin/tests/themes/valo/WindowControlButtonFocus.java [new file with mode: 0644]
uitest/src/test/java/com/vaadin/tests/themes/valo/WindowControlButtonFocusTest.java [new file with mode: 0644]

index a20d0108ad315b1b5a4626619cd157e03cfa7b7f..310bb9b24f810a041376be5e926c5859cda8efb1 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a20d0108ad315b1b5a4626619cd157e03cfa7b7f
+Subproject commit 310bb9b24f810a041376be5e926c5859cda8efb1
index 52dac4f6f1922b7a01e49c45661dac8fd28abc50..75f914a50bdded83cc41d0a04717471f92f2e75e 100644 (file)
@@ -188,6 +188,31 @@ $v-window-modality-curtain-background-color: #222 !default;
       color: inherit;
     }
   }
+  
+  .#{$primary-stylename}-closebox:focus::after {
+    content: "";
+    position: absolute;
+    top: round($v-unit-size/6);
+    right: round($v-unit-size/6);
+    bottom: round($v-unit-size/6);
+    left: round($v-unit-size/18);
+    border-radius: $v-window-border-radius;
+    
+    @include valo-focus-style;
+  }
+  
+  .#{$primary-stylename}-maximizebox:focus::after,
+  .#{$primary-stylename}-restorebox:focus::after {
+    content: "";
+    position: absolute;
+    top: round($v-unit-size/6);
+    right: round($v-unit-size/18);
+    bottom: round($v-unit-size/6);
+    left: round($v-unit-size/6);
+    border-radius: $v-window-border-radius;
+    
+    @include valo-focus-style;
+  }
 
   .#{$primary-stylename}-closebox {
     padding-right: round($v-unit-size/9);
@@ -222,6 +247,10 @@ $v-window-modality-curtain-background-color: #222 !default;
       width: $v-unit-size;
       padding-right: 0;
       border-bottom-left-radius: $v-window-border-radius;
+      
+      &:focus::after {
+        left: round($v-unit-size/6);
+      }
     }
   }
 
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/WindowControlButtonFocus.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/WindowControlButtonFocus.java
new file mode 100644 (file)
index 0000000..ce30991
--- /dev/null
@@ -0,0 +1,25 @@
+package com.vaadin.tests.themes.valo;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class WindowControlButtonFocus extends AbstractTestUI {
+    @Override
+    protected void setup(VaadinRequest request) {
+        Window window = new Window("Window", new Label());
+        window.center();
+        addWindow(window);
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8918;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Window control buttons should have noticeable focus styles.";
+    }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/themes/valo/WindowControlButtonFocusTest.java b/uitest/src/test/java/com/vaadin/tests/themes/valo/WindowControlButtonFocusTest.java
new file mode 100644 (file)
index 0000000..fb095c0
--- /dev/null
@@ -0,0 +1,48 @@
+package com.vaadin.tests.themes.valo;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.WindowElement;
+import com.vaadin.testbench.parallel.Browser;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class WindowControlButtonFocusTest extends MultiBrowserTest {
+
+    @Override
+    public List<DesiredCapabilities> getBrowsersToTest() {
+        return Arrays.asList(Browser.CHROME.getDesiredCapabilities(),
+                Browser.IE11.getDesiredCapabilities());
+    }
+
+    @Test
+    public void focusMaximize() throws IOException, InterruptedException {
+        openTestURL();
+
+        WebElement window = $(WindowElement.class).first();
+        WebElement maximize = window
+                .findElement(By.className("v-window-maximizebox"));
+
+        executeScript("arguments[0].focus()", maximize);
+        compareScreen(window, "maximize-focused");
+    }
+
+    @Test
+    public void focusClose() throws IOException {
+        openTestURL();
+
+        WebElement window = $(WindowElement.class).first();
+        WebElement close = window
+                .findElement(By.className("v-window-closebox"));
+
+        executeScript("arguments[0].focus()", close);
+        compareScreen(window, "close-focused");
+    }
+
+}