diff options
author | Artur Signell <artur@vaadin.com> | 2016-04-15 18:39:10 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-04-18 11:34:44 +0000 |
commit | 871960c70866e3c70eeaedfa20b1a1b6917f68fa (patch) | |
tree | 6638d0f5b57c4f00609f2337a9cfa58d570f898d /client | |
parent | acba4ff413db5a6e68b85c4e7dd72d76cc7367f6 (diff) | |
download | vaadin-framework-871960c70866e3c70eeaedfa20b1a1b6917f68fa.tar.gz vaadin-framework-871960c70866e3c70eeaedfa20b1a1b6917f68fa.zip |
Only handle shortcuts targeted for UI or body element (#19498)
Change-Id: I796d7e4ac94db1b2b9d8698e9753a5be007a1c8c
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/ui/UIConnector.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 9ffb9cfba9..6f4872729d 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -507,8 +507,16 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void onKeyDown(KeyDownEvent event) { if (getWidget().actionHandler != null) { - getWidget().actionHandler.handleKeyboardEvent((Event) event - .getNativeEvent().cast()); + Element target = Element.as(event.getNativeEvent() + .getEventTarget()); + if (target == Document.get().getBody() + || getWidget().getElement().isOrHasChild(target)) { + // Only react to body and elements inside the UI + getWidget().actionHandler + .handleKeyboardEvent((Event) event + .getNativeEvent().cast()); + } + } } }, KeyDownEvent.getType()); |