summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2019-03-06 08:16:14 +0200
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>2019-03-06 08:16:14 +0200
commit6854108f316d04b8c5c10cc0add38f6158b43845 (patch)
treeb92a300d854cd7a7c9cd14b683f21c4af8fc7995
parent6cc773fb7c717328fbce7255fa419581b7609a92 (diff)
downloadvaadin-framework-6854108f316d04b8c5c10cc0add38f6158b43845.tar.gz
vaadin-framework-6854108f316d04b8c5c10cc0add38f6158b43845.zip
Remove redundant check for for Firefox (#11471)
* Add Test file * Remove redundant check for for Firefox It seems that in older versions of Firefox (at least, older than 45) the KeyPress event should be used instead of KeyDownHandler. At some point (works already on 58 version, the current one is 65) the issue was resolved and starting from Firefox 65 this hook prevents from navigating in the pop-up via keyboard. Simply removing additional logic makes navigating in both DateField and InlineDateField possible Fixes #11465
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoard.java31
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java30
3 files changed, 62 insertions, 10 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java
index 7a534de724..8f32d35acb 100644
--- a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java
+++ b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java
@@ -214,16 +214,7 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>>
setStyleName(VDateField.CLASSNAME + "-calendarpanel");
Roles.getGridRole().set(getElement());
- /*
- * Firefox auto-repeat works correctly only if we use a key press
- * handler, other browsers handle it correctly when using a key down
- * handler
- */
- if (BrowserInfo.get().isGecko()) {
- addKeyPressHandler(this);
- } else {
- addKeyDownHandler(this);
- }
+ addKeyDownHandler(this);
addFocusHandler(this);
addBlurHandler(this);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoard.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoard.java
new file mode 100644
index 0000000000..e1bb5476f2
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoard.java
@@ -0,0 +1,31 @@
+package com.vaadin.tests.components.datefield;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.AbstractLocalDateField;
+import com.vaadin.ui.DateField;
+
+@Widgetset("com.vaadin.DefaultWidgetSet")
+public class DateFieldNavigationKeyBoard extends AbstractTestUI {
+
+ static final String DATEFIELD_ID = "datefield";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final AbstractLocalDateField df = new DateField();
+ df.setId(DATEFIELD_ID);
+ addComponent(df);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Navigation in popup should be possible via arrows in Firefox 65 and later";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 11465;
+ }
+
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java
new file mode 100644
index 0000000000..1b9d88957a
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.datefield;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+import static org.junit.Assert.assertNotEquals;
+
+public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest {
+ @Test
+ public void testNavigation() {
+ openTestURL();
+ // Opening pop-up
+ findElement(By.className("v-datefield-button")).click();
+ waitForElementVisible(By.className("v-datefield-calendarpanel"));
+ // Focused element in the calendarPanel
+ WebElement focused = findElement(
+ By.className("v-datefield-calendarpanel-day-focused"));
+ // Value in it
+ String dayValue = focused.getText();
+ findElement(By.className("v-datefield-calendarpanel"))
+ .sendKeys(Keys.ARROW_LEFT);
+ assertNotEquals(dayValue,
+ findElement(
+ By.className("v-datefield-calendarpanel-day-focused"))
+ .getText());
+ }
+}