Change CopyableLabel to hide onKeyUp
This changes the CopyableLabel to hide itself onKeyUp, after a
copy, since hiding onKeyPress would hide the text box before Safari
had a chance to copy it. Ultimately, the effect is the same, it
just delays the processing a little further on.
Bug: Issue 2635
Change-Id: I06a25b81c1da7286a09561732510fe4d6835a2a7
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
index 1a8c275..a0392f8 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/clippy/client/CopyableLabel.java
@@ -22,6 +22,8 @@
import com.google.gwt.event.dom.client.ClickHandler;
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.http.client.URL;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
@@ -189,9 +191,14 @@
switch (event.getCharCode()) {
case 'c':
case 'x':
- Scheduler.get().scheduleDeferred(new Command() {
- public void execute() {
- hideTextBox();
+ textBox.addKeyUpHandler(new KeyUpHandler() {
+ @Override
+ public void onKeyUp(final KeyUpEvent event) {
+ Scheduler.get().scheduleDeferred(new Command() {
+ public void execute() {
+ hideTextBox();
+ }
+ });
}
});
break;