in almost all the popup button implementations I have seen (within gui toolkits like gtk or qt and within web apps like GMail) the trigger button is rendered as pressed until the popup is closed. I think jQuery UI popup should comply with those implementations: in particular, we should add a class to the trigger element (something like ui-popup-state) that reflects the state of the popup.
this is my first post and before anything else, I want to thank all of you, jQuery developers, for your great work.
For a project of mine, I'm using jquery ui 1.9m6 and I noted a strange behavior of the ui popup component.
When you try to close the popup menu clicking on the trigger (let's say a button as in ContextMenu demo) and you keep the mouse button pressed down for a time longer than 0.1 sec. (that often happens to me...) the menu doesn't close but it just flickers on the screen.
That happens because if you keep the mouse button pressed down longer than 0.1 sec. the trigger click event is fired after the menu has been closed by the its focusout event. So the click just reopens the menu.
I think the least invasive way* to solve the problem is to wrap a div around, trigger and menu, and to bind focusout (and focusin ) handler to this new element so it is no more invoked when you click on the trigger.
I attached a patch that implements my idea. I know very little about jQuery UI therefore there could be better solutions, anyway I hope this can be of some utility.
Bye...
* Another possible solution is to use mousedown instead of click event to open and close the popup menu.