diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java index 7bd023396d..6f8bf80393 100644 --- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java +++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyHelpPopup.java @@ -16,8 +16,11 @@ package com.google.gwtexpui.globalkey.client; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.FlowPanel; @@ -38,7 +41,7 @@ import java.util.List; public class KeyHelpPopup extends PluginSafePopupPanel implements - KeyPressHandler { + KeyPressHandler, KeyUpHandler { private final FocusPanel focus; public KeyHelpPopup() { @@ -77,6 +80,7 @@ public class KeyHelpPopup extends PluginSafePopupPanel implements DOM.setStyleAttribute(focus.getElement(), "outline", "0px"); DOM.setElementAttribute(focus.getElement(), "hideFocus", "true"); focus.addKeyPressHandler(this); + focus.addKeyUpHandler(this); add(focus); } @@ -100,6 +104,13 @@ public class KeyHelpPopup extends PluginSafePopupPanel implements hide(); } + @Override + public void onKeyUp(final KeyUpEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { + hide(); + } + } + private void populate(final Grid lists) { int end[] = new int[5]; int column = 0;