Search code examples
extjsextjs4extjs4.2keyboard-events

How to allow some keyboard events on menu items that are by default stopping the event?


I am trying to have a small form in my menu item. I have split button that has one item. In that item I have form: datefield, textfield, button, etc...

The issue is connected with some keystrokes such as left arrow, right arrow. This key events are supposed to hide menu item by default. Now I need to disable them since every time an arrow button is used in my textfield, it hides the menu.

I am using beforehide event, but cannot find a way to achieve to my goal. I could not find any events similar to keydown to handle this case.

One more key backspace is also used for editing the textfield, but this one redirects the browser.

IN SHORT: I want to be able to freely use the keyboard in my menu item's textfield without hiding it. Is this possible?


Solution

  • Just use enableKeyNav: false in the menu configuration. From the doc:

    enableKeyNav : Boolean

    True to enable keyboard navigation for controlling the menu. This option should generally be disabled when form fields are being used inside the menu.

    Defaults to: true