View Full Version : [2.0b1][SOLVED] Keyboard navigation problem with disabled menu items

28 Oct 2007, 12:59 AM
Here is a strange problem I found.
If you have a menu which has a sub-menu in which all items are disabled, and you use the keyboard to navigate the menu, and then press the LEFT key to open the all-disabled sub-menu, you have no way to use the keyboard any more. The selection seems to be hidden behind the disabled menu items in the sub-menu, and you cannot use the RIGHT key to go back to the parent menu.


28 Oct 2007, 1:17 AM
pls post details as per 13985. thanks.

28 Oct 2007, 1:23 AM
I know this is not a valid bug report, but I don't have time to look deep into it now, and I just wanted to let you know about it before 2.0 is released. I will update it once I have some more time.

Basically, this happens on both Firefox and Internet Explorer 7 on Windows XP. I use prototype + adapter.

28 Oct 2007, 10:46 AM
Does this solve it for you?

Ext.override(Ext.menu.Menu, {
tryActivate : function(start, step){
var items = this.items;
for(var i = start, len = items.length; i >= 0 && i < len; i+= step){
var item = items.get(i);
if(!item.disabled && item.canActivate){
this.setActiveItem(item, false);
return item;
this.activeItem = items.get(i-step);
return false;

28 Oct 2007, 1:01 PM
Yes indeed, this solved the problem. Thanks.

However, this introduces another problem.
Before your fix, when using the up and down keys on a menu with all items enabled, you were able to scoll up/down and then continue from the other end.

With this fix, when going down, the last item remains selected, although the selection does start from above. When going up, the selection is stuck on the first item and doesn't start from the bottom.

Thanks for trying to solve this,

28 Oct 2007, 8:45 PM
I updated the previously-posted patch. Please try it again.

28 Oct 2007, 11:33 PM
Yes, this last version solves both problems. Thanks Brian!

Is this fix going to enter Ext 2.0?

8 Nov 2007, 12:03 AM
Just to close this out, we will probably not add this patch to Ext. As-is, it is not an ideal general solution since it's setting an active item for your purposes (only because the sub-menu is entirely disabled), even though technically there isn't one. A better solution would be adding a non-visual focus element that can be active without anything visually activated, but that's a low priority change that won't be going into 2.0. We'll keep it on the list for possibly refactoring in a later version, but for now I'll go ahead and close this thread as resolved with the provided patch.