From f24723c1dbd9635d6bc54fd1f0ba69f26e647438 Mon Sep 17 00:00:00 2001 From: Tatu Lund Date: Wed, 3 Apr 2019 14:32:35 +0300 Subject: [PATCH] Change VSlider to use Event.ONKEYDOWN with Firefox 65+ (#11506) Fixes #11502 --- .../main/java/com/vaadin/client/ui/VSlider.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/com/vaadin/client/ui/VSlider.java b/client/src/main/java/com/vaadin/client/ui/VSlider.java index 9a572b95c3..b6418f8d55 100644 --- a/client/src/main/java/com/vaadin/client/ui/VSlider.java +++ b/client/src/main/java/com/vaadin/client/ui/VSlider.java @@ -283,11 +283,7 @@ public class VSlider extends SimpleFocusablePanel increaseValue(true); } else if (DOM.eventGetType(event) == Event.MOUSEEVENTS) { processBaseEvent(event); - } else if (BrowserInfo.get().isGecko() - && DOM.eventGetType(event) == Event.ONKEYPRESS - || !BrowserInfo.get().isGecko() - && DOM.eventGetType(event) == Event.ONKEYDOWN) { - + } else if (isNavigationEvent(event)) { if (handleNavigation(event.getKeyCode(), event.getCtrlKey(), event.getShiftKey())) { @@ -313,6 +309,14 @@ public class VSlider extends SimpleFocusablePanel } } + private boolean isNavigationEvent(Event event) { + if (BrowserInfo.get().isGecko() && BrowserInfo.get().getGeckoVersion() < 65) { + return DOM.eventGetType(event) == Event.ONKEYPRESS; + } else { + return DOM.eventGetType(event) == Event.ONKEYDOWN; + } + } + private void processMouseWheelEvent(final Event event) { final int dir = DOM.eventGetMouseWheelVelocityY(event); -- 2.39.5