Opened 11 years ago

Closed 8 years ago

Last modified 6 years ago

#7111 closed task (fixed)

Menu: handle many events with the menu - rather than menu items

Reported by: Nathan Toone Owned by: bill
Priority: high Milestone: 1.8
Component: Dijit Version: 1.1.1
Keywords: Cc: alex
Blocked By: Blocking:

Description

Alex suggested that we handle events in the menu widget rather than having them all on the menuItem widgets themselves.

We should replace the onClick and onMouseEnter/onMouseLeave functions on dijit.MenuItem? with corresponding functions on dijit.Menu

Attachments (1)

menuDelegated.patch (3.4 KB) - added by bill 8 years ago.
start of patch, apply against [27446]

Download all attachments as: .zip

Change History (17)

comment:1 Changed 11 years ago by bill

Summary: dijit.Menu: handle many events with the menu - rather than menu itemsMenu: handle many events with the menu - rather than menu items

We can't remove MenuItem.onClick() because it would break backwards compatibility. At least not until 2.0.

It might be possible to have a callback on Menu in addition to the one on MenuItem, and that's what Menu.onItemClick() basically is, and also Menu.onExecute().

However, this is tricky to really have work. Menus can contain multiple subwidgets, not just MenuItem but also ColorPicker, !Calendar (except right now that breaks a11y)... I think it might even be possible to have a TooltipDialog but I'd need to test.

Anyway, this is something I thought about during the design of Menu and there's a reason it works the way it does now.

comment:2 Changed 11 years ago by Nathan Toone

Owner: changed from nathan to Nathan Toone

comment:3 Changed 11 years ago by Nathan Toone

Reporter: changed from nathan to Nathan Toone

comment:4 Changed 11 years ago by Nathan Toone

Milestone: 2.0

comment:5 Changed 10 years ago by Nathan Toone

Owner: Nathan Toone deleted

Unassigning my tickets.

comment:6 Changed 8 years ago by bill

This should be easier w/the event delegation in dojo/on, except that it's broken for <tr>; I filed #14509 .

comment:7 Changed 8 years ago by bill

In [27446]:

Some missing this.inherited() calls I noticed while working on event changes, refs #7111 !strict

Changed 8 years ago by bill

Attachment: menuDelegated.patch added

start of patch, apply against [27446]

comment:8 Changed 8 years ago by bill

Milestone: 2.01.8
Owner: set to bill
Status: newassigned
Type: enhancementtask

comment:9 Changed 8 years ago by bill

In [27500]:

Move monitoring for mouse enter / mouse leave / ondijitclick from MenuItem to Menu. MenuItem is still monitoring onmouseenter/onmouseleave indirectly though, via _CssStateMixin.

Refs #7111 !strict.

comment:10 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

In [27501]:

Disable monitoring of onmouseenter/onmouseleave/onmousedown events in MenuItem via _CssStateMixin. _CssStateMixin still knows about hover state, and sets appropriate CSS classes, because _MenuBase sets this.hovering for each MenuItem.

Start using :hover and :active pseudo-selectors except for IE6, where they aren't supported.

Fixes #7111 !strict.

comment:11 Changed 8 years ago by bill

In [27504]:

Do monitoring for widget hover/active state from a listenerd on <body>, rather than creating separate listeners for each widget. It's a bit like a "hover manager", similar to the focus manager in focus.js. Improves page-load performance. Refs #14568, #7111 !strict.

comment:12 Changed 8 years ago by liucougar

In [27815]:

Refs #7111: make sure onClick is triggered on CheckedMenuItem?

regression introduced in r27504

comment:13 Changed 8 years ago by bill

Resolution: fixed
Status: closedreopened

Reopening as reminder to change it to pass a function to on.selector() rather than ".dijitMenuItem", to eliminate dojo/query dependency. But waiting on answer to #14575 first.

If I end up using ".dijitMenuItem", then need to put dojo/query in the dependency list.

comment:14 Changed 8 years ago by bill

Resolution: fixed
Status: reopenedclosed

In [28494]:

Avoid dojo/query dependency by using custom selector method, fixes #7111 !strict.

comment:15 Changed 6 years ago by Bill Keese <bill@…>

In 1316aeabdfd63b8039440d7a35e79510c90abc1e/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:16 Changed 6 years ago by Bill Keese <bill@…>

In 116331ffca4600b1c4ee6e3f94e7faf83ae2a57b/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.