summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-10-10 22:43:03 +0300
committerPekka Hyvönen <pekka@vaadin.com>2016-12-09 09:39:00 +0200
commit16c54b33c4c66edfc20f42b09e1726de67931c96 (patch)
tree16d78c91af5a249ca62eb6dbffc915ad748854ea /client/src
parent97a75f1abcbd1c9001a7ff5b75713e3a913748cb (diff)
downloadvaadin-framework-16c54b33c4c66edfc20f42b09e1726de67931c96.tar.gz
vaadin-framework-16c54b33c4c66edfc20f42b09e1726de67931c96.zip
Make modal window block shortcuts for underlying components (#20366)
Change-Id: Ibb3b52b652d77a1bfa786417b1c92fd0a578035f
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VWindow.java11
-rw-r--r--client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java3
2 files changed, 14 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java
index 5a316933ff..8d64bb6b4f 100644
--- a/client/src/main/java/com/vaadin/client/ui/VWindow.java
+++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java
@@ -1519,4 +1519,15 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
return WINDOW_ORDER_HANDLER.addHandler(WindowOrderEvent.getType(),
handler);
}
+
+ /**
+ * Checks if a modal window is currently open.
+ *
+ * @return <code>true</code> if a modal window is open, <code>false</code>
+ * otherwise.
+ */
+ public static boolean isModalWindowOpen() {
+ return Document.get().getBody()
+ .hasClassName(MODAL_WINDOW_OPEN_CLASSNAME);
+ }
}
diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
index 677abbbecb..180898453b 100644
--- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
@@ -526,6 +526,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
shortcutContextWidget.addDomHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
+ if (VWindow.isModalWindowOpen()) {
+ return;
+ }
if (getWidget().actionHandler != null) {
Element target = Element
.as(event.getNativeEvent().getEventTarget());