Fixes Issue #411.
PopupPanel in autohide mode now hides itself when it sees an outside mousedown
event to prevent it from immediately closing in the case where the panel was
opened from within a mousedown handler.
Patch by: bobv
Review by: knorton
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@992 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/PopupPanel.java b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
index f415c27..8fc1b4f 100644
--- a/user/src/com/google/gwt/user/client/ui/PopupPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/PopupPanel.java
@@ -139,9 +139,10 @@
return true;
}
- // If it's an outside click event, and auto-hide is enabled:
- // hide the popup and _don't_ eat the event.
- if (!eventTargetsPopup && autoHide && (type == Event.ONCLICK)) {
+ // If it's an outside click and auto-hide is enabled:
+ // hide the popup and _don't_ eat the event. ONMOUSEDOWN is used to
+ // prevent problems with showing a popup in response to a mousedown.
+ if (!eventTargetsPopup && autoHide && (type == Event.ONMOUSEDOWN)) {
hide(true);
return true;
}