cvarona
554 1 6

Hi there,

I would like to achieve the following:
a) Focus the first menuitem in a contextual menu popup upon opening
b) Restore the focus to the component the contextual menu refers to upon closing

This is my test code:

<vbox>
Right click the textbox
<textbox id="tb" focus="true" context="menupopup, position=after_end" />
<label id="lbl" />
<menupopup id="menupopup" onOpen='if( event.isOpen() ) mi.setFocus( true ); else tb.focus(); lbl.setValue( event.isOpen()? "A": "B" );'>
</vbox>

Upon right-clicking the textbox the menu popup gets opened and the onOpen event is fired, as demonstrated by the status label getting the value 'A'. The first menuitem however does not get focused at all.

a) If I do so by pressing the left arrow key no onOpen event is fired at all; I guest it nonetheless should, at least if the left arrow is meant as a mean of closing a popup via the keyboard. It would be nice if popups could be somehow configured to be closed by using ctrlKeys or Esc.
b) If I do so by clicking somewhere outside the popup the onOpen event is fired as expected

Any idea as to why menuitems are reluctant to get focused and how to leave popups using the keyboard while at the same time being able to catch the onOpen event?

With kind regards

César Varona

delete retag edit
Be the first one to reply this discussion!
[hide preview]