Popup / Menupoup / Menuitem

asked 2011-07-15 08:39:15 +0800

cvarona gravatar image 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:

	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" );'>
		<menuitem id="mi" label="Some menu item" onOK='menupopup.close();' onClick='menupopup.close();'/>

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.

When leaving the menupopup
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 flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-07-15 08:39:15 +0800

Seen: 243 times

Last updated: Jul 15 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More