- Hi Mark -
I dug into the problem and figured out that the root case is that when
a Button's Menu is hidden focus is sent back to the Button. You can
work around this issue by attaching a mousedown event listener to the
form that focus the event target if it is not a Button instance. Here
is an example:
I'll fix this bug for the next release of YUI Button.
On May 27, 2009, at 4:19 AM, tedster_uk wrote:
> Hi all,
> I'm having a problem with menu button, created by specifying a
> menuItems, as is done in menu5 of this yui menu button examples page:
> If a button is clicked on, it displays the menu normally, but, if a
> user then clicks on another form element, rather than a menu item,
> the menu button still seems to handle / block events in some way,
> and the events of the form element clicked on will not fire until it
> is clicked on again, to fully 'deactivate' the menu button.
> To replicate this simply add a text element, with an onkeyup event,
> to the source from the above examples page. Then click on either
> menu 1, 2 or 5, to display its menu, and then click directly into
> the text box, and press a key, which should fire the keyup handler,
> but will not.
> function testFunction()
> status += "KEYUP!";
> <input type="text" id="testtest" onkeyup="testFunction()" />
> This problem does not occur however where the menu drop down is made
> from an overlay.
> A visual sign that this is going to ocurr is that the menu button
> retains its blue highlight styling.
> Is there anyway to force the menu button into an 'off' state? It has
> certainly lost focus, but seems to be still handling the events that
> should be getting handled by the next control.
> Any advice on a fix / workaround (ideally without having to recode
> the menu contents as an overlay) would be very much appreciated.
> Thanks in advance, Mark