Opened 8 years ago
Closed 8 years ago
#16784 closed defect (fixed)
[regression] exception in MenuBase
Reported by: | Douglas Hays | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.9 |
Component: | Dijit | Version: | 1.9.0a2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Load test_Menu.html (I'm testing on Chrome).
Click File, then click Save (everything seems OK).
Click File again, and again click Save (exception is thrown about focusNode being null).
This worked OK in 1.8.
Change History (4)
comment:1 Changed 8 years ago by
Milestone: | tbd → 1.9 |
---|---|
Priority: | undecided → high |
comment:2 Changed 8 years ago by
comment:3 Changed 8 years ago by
When the menu is closed, MenuBar tries to restore focus to the previously focused MenuBarItem (the one labeled "File"). It uses this.focusedChild which, unsurprisingly is null, since there is no focused child.
In more detail:
- user clicks on "File", which sets MenuBar.focusedChild to the "File" MenuBarItem
- the drop down menu opens, but this doesn't set this.focusedChild to null (although it probably should), because there's no _onBlur() event since focus has moved to a child of the MenuBar
- when the menu closes, focus is returned to the "File" MenuBar item, and this code in MenuBase sets focusedChild to null, even though the MenuBar is in fact focused:
// Repeat what _KeyNavContainer.onBlur() does, so that the MenuBar gets treated as blurred even though the user // hasn't clicked or focused anywhere outside of the MenuBar yet. Otherwise, the Menu code gets confused since // the menu is in a passive state but this.focusedChild is still set. domAttr.set(this.domNode, "tabIndex", this.tabIndex); if(this.focusedChild){ this.focusedChild.set("tabIndex", "-1"); this._set("focusedChild", null); }
- the second time the user clicks "File" in the MenuBar, _onChildFocus() isn't called, because there's no focusin event because "File" is already focused... this.focusedChild remains null
- the second time the menu closes, MenuBar tries to restore focus by using this.focusChild, and gets an exception
Note: See
TracTickets for help on using
tickets.
Good catch. Started in [30082].