Opened 9 years ago

Last modified 9 years ago

#16300 closed defect

MenuBar: tabIndex problems after focusing programatically — at Version 1

Reported by: hyang Owned by: bill
Priority: undecided Milestone: 1.9
Component: Dijit Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

1: get test_Menu.html source code under folder dijit\tests

2: add method below to move focus to menubar with CTRL+M

       function addListenerToDoc(event){
		if(event.ctrlKey && event.charCode == 109){//Ctrl+M
			var menubar = dijit.byId('menubar');
	    	var menu = dijit.byId('file');
	    	if(menubar && menu){
	    		menubar._markActive();
	    		if(menubar.focusedChild) return;
	    		menubar.focusChild(menu);
	    		if(menu.popup)
	    			menubar._openPopup();
	    	}
		}
	}

3: call the method in addOnLoad

4: browser the page, and press CTRL+M to move focus to menubar

5: press ESC to close the popup, the focus on the file menu

6: press Shift+ tab

Defect: the focus still on the file menu

Change History (2)

Changed 9 years ago by hyang

Attachment: test_Menu.html added

source code

comment:1 Changed 9 years ago by bill

Description: modified (diff)
Milestone: tbd1.9
Status: newassigned
Summary: move focus to menubar with keyboard, and focus does not move in some caseMenuBar: tabIndex problems after focusing programatically

Hmm, yes, Menu (and anything derived from _KeyNavContainer) is not designed to get focus programatically.

Originally the container has a tabIndex, and when it receives focus via the tab key, it immediately shifts focus to it's first child, and sets it's own tabIndex to -1 (or removes it's tab index). This is what _onContainerFocus() does.

But in this case _onContainerFocus() isn't called, so the shift-tab moves from the File MenuItem to the container itself.

Note: See TracTickets for help on using tickets.