diff options
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()); |