Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16300 closed defect (fixed)

MenuBar: tabIndex problems after focusing programatically

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

Attachments (1)

test_Menu.html (24.5 KB) - added by hyang 7 years ago.
source code

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by hyang

Attachment: test_Menu.html added

source code

comment:1 Changed 7 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.

comment:2 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [29911]:

Make sure container's tabindex is removed whenever one of the container's children gets focus, regardless of how it got focus. Fixes #16300 !strict.

comment:3 Changed 7 years ago by bill

In [29924]:

just fixing bug number in comment, refs #16300.

Note: See TracTickets for help on using tickets.