Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#18231 closed defect (invalid)

[1.7.4 > 1.7.5 regression] Unexpected mouse.leave event

Reported by: Sebastien Pereira Owned by: Sebastien Pereira
Priority: undecided Milestone: tbd
Component: Core Version: 1.7.5
Keywords: Cc:
Blocked By: Blocking:

Description

In some cases, a mouse.leave event is received with 1.7.5 while not in 1.7.4.

How to reproduce

  • open a test page (see attached files page174.html and page175.html)
  • click "Sort" button: a menu appears
  • move mouse pointer over the "Sort results by" area to select an entry

Result

  • working scenario (page174.html) : you can select an entry + the menu disappear when you move the mouse outside the "menubuttonsort" area.
  • non-working scenario (page175.html) : the menu immediately disappears when the mouse leaves the button area.

Tested on following desktop browsers:

  • IE9
  • FF27/31
  • Chrome36

Attachments (2)

page174.html (1.4 KB) - added by Sebastien Pereira 5 years ago.
working scenario (1.7.4)
page175.html (1.4 KB) - added by Sebastien Pereira 5 years ago.
non working scenario (1.7.5)

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by Sebastien Pereira

Attachment: page174.html added

working scenario (1.7.4)

Changed 5 years ago by Sebastien Pereira

Attachment: page175.html added

non working scenario (1.7.5)

comment:1 Changed 5 years ago by Sebastien Pereira

Owner: set to Sebastien Pereira
Status: newassigned

comment:2 Changed 5 years ago by Sebastien Pereira

Issue can be reproduced in subsequent releases (1.8, 1.9 and 1.10)

FYI it occurs starting from this change: https://github.com/dojo/dojo/commit/aa24d70dd1281e528f5a69c24fb3f3dbab621190#diff-d41d8cd98f00b204e9800998ecf8427e related to https://bugs.dojotoolkit.org/ticket/15862

However, the root cause seems to be a misuse of dojo.on() which expects the target object or DOM element as first parameter (ref inline doc: https://github.com/dojo/dojo/blob/1.7.4/on.js#L7). This is not what returns query("#menubuttonsort") in this code:

    on(query("#menubuttonsort"), mouse.leave, function(){
        query(".menu.sort").style("display", "none");
        query(".menu.sort").style("opacity", "0");
        query(".menu.sort").style("top", "80px");
    });

While replacing the first argument by query("#menubuttonsort")[0] would solve the issue, the recommended way to write the handler is:

    query("#menubuttonsort").on(mouse.leave, function(){
        query(".menu.sort").style("display", "none");
        query(".menu.sort").style("opacity", "0");
        query(".menu.sort").style("top", "80px");
    });

comment:3 Changed 5 years ago by Sebastien Pereira

Resolution: invalid
Status: assignedclosed

Closing as invalid - not a regression - user code must be fixed.

comment:4 Changed 5 years ago by dylan

I believe the following would fix their code as well:

on(query("#menubuttonsort")[0], mouse.leave, function(){
        query(".menu.sort").style("display", "none");
        query(".menu.sort").style("opacity", "0");
        query(".menu.sort").style("top", "80px");
    });
Note: See TracTickets for help on using tickets.