Allow "Keyboard Shortcuts" help popup to be closed with Escape key
Bug: Issue 1996 Change-Id: I7391acad508657b3c7d3e3211bb7a51778f4a7e9
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user