Browse Source

Fix styling of Window control buttons to show focus (#10285)

Fixes #8918
tags/8.3.0.alpha1
Anna Koskinen 6 years ago
parent
commit
0fd59e941b

+ 1
- 1
tests/screenshots

@@ -1 +1 @@
Subproject commit a20d0108ad315b1b5a4626619cd157e03cfa7b7f
Subproject commit 310bb9b24f810a041376be5e926c5859cda8efb1

+ 29
- 0
themes/src/main/themes/VAADIN/themes/valo/components/_window.scss View 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);
}
}
}


+ 25
- 0
uitest/src/main/java/com/vaadin/tests/themes/valo/WindowControlButtonFocus.java View File

@@ -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.";
}
}

+ 48
- 0
uitest/src/test/java/com/vaadin/tests/themes/valo/WindowControlButtonFocusTest.java View File

@@ -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");
}

}

Loading…
Cancel
Save