diff options
Diffstat (limited to 'client')
3 files changed, 13 insertions, 4 deletions
diff --git a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java index 2a9a8d4204..e5d5ea8a25 100644 --- a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java +++ b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java @@ -188,9 +188,10 @@ public class ServerRpcQueue { * Triggers a send of server RPC and legacy variable changes to the server. */ public void flush() { - if (flushScheduled) { + if (flushScheduled || isEmpty()) { return; } + flushPending = true; flushScheduled = true; Scheduler.get().scheduleFinally(scheduledFlushCommand); 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 9ffb9cfba9..6f4872729d 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 @@ -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()); diff --git a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java index c2752f1953..7b0d886c39 100644 --- a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java +++ b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java @@ -20,7 +20,7 @@ import org.junit.Test; /** * - * @since + * @since 7.7 * @author Vaadin Ltd */ public class ServerMessageHandlerTest { |