Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16426 closed defect (fixed)

[regression] Items in MenuBar no longer work without dijitMenuItem style class

Reported by: Randy Hudson Owned by: bill
Priority: undecided Milestone: 1.8.2
Component: Dijit Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

In 1.8.x, some code was refactored, and in _MenuBase:

matches = function(node){ return domClass.contains(node, "dijitMenuItem"); };

was added. We have menubars and items with alternative styling, achieved by changing the baseClass property of the items in the menubar. In 1.8, those items will no longer open because the above matcher is using a CSS style class to determine whether a dom node's widget is an "instance of" a MenuItem?.

If I add this style class back to the menuitem, it causes undesired style changes, e.g. text color becomes black.

This matcher should do something smarter like getting the widget for the node and checking if the widget is a menuitem. Or the items could switch back to handling the events themselves and coordinating with their parent.

Change History (5)

comment:1 Changed 7 years ago by bill

Milestone: tbd1.8.3
Status: newassigned

That's true, it's from #7111 which switched Menu to use event delegation for performance etc.

I could switch that matching function to match any direct child of the Menu:

matches = function(node){ 
    var child = registry.byNode(node);
    return node && node.getParent() == _self;

or alternately:

matches = function(node){ return node.parentNode == _self.containerNode; }

Also, something I did for _KeyNavMixin was to let the subclass override the matching function. (It's called childSelector in _KeyNavMixin.)

I'll think about that and implement one of those approaches.

comment:2 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [30127]:

Don't require children of Menu to have class "dijitMenuItem", fixes #16426 on trunk/ !strict.

comment:3 Changed 7 years ago by bill

In [30128]:

Don't require children of Menu to have class "dijitMenuItem", fixes #16426 on 1.8/ branch !strict.

comment:4 Changed 7 years ago by bill

Milestone: 1.8.31.8.2
Summary: Items in MenuBar no longer work without dijitMenuItem style class[regression] Items in MenuBar no longer work without dijitMenuItem style class

comment:5 Changed 7 years ago by bill

In [30234]:

Quick fix to avoid exception when mousing over MenuSeparator?, fixes #16491, refs #16426 on trunk !strict.

Note: See TracTickets for help on using tickets.