Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10420 closed bug (fixed)

MouseWheel

Reported by: anonymous Owned by: dmethvin
Priority: blocker Milestone: 1.7
Component: misc Version: 1.7b1
Keywords: Cc:
Blocked by: Blocking:

Description

I have been using https://github.com/brandonaaron/jquery-mousewheel for years and now it`s broken. If I log event ( console.log(delta, deltaX, deltaY); ) then output is - Firefox: 0 0 0 Chrome: 0 0 -1

(btw, works fine for jQuery 1.6.4 and output is, for example: -1 0 -1)

Change History (17)

comment:1 Changed 12 years ago by Timmy Willison

Component: unfiledmisc
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Please file a bug with jQuery mousewheel or you can provide a reduced test case that does not include plugins to indicate an issue with jQuery core.

comment:2 Changed 12 years ago by anonymous

Demos:

Not working - http://jsfiddle.net/Ly9x3/

Working - http://jsfiddle.net/Ly9x3/1/

I would like to find the root of the problem but I only can see that after fixing event (e.g., event = $.event.fix(orgEvent); ) there are no such attributes as wheelDelta OR detail so this plugin, obviously, fails.

An I have no idea what`s going on under that magical $.event.fix

comment:3 Changed 12 years ago by dmethvin

Resolution: invalid
Status: closedreopened

I'm going to reopen this, as it's a result of the jQuery.event.fix refactoring in 1.7b1. The solution should be simple, we just need to have the plugin get its values from origEvent rather than assuming they were copied to event. Another solution would be to put the properties onto jQuery.event.fixProps but simpler seems better.

comment:4 Changed 12 years ago by dmethvin

Owner: set to dmethvin
Status: reopenedassigned

comment:5 Changed 12 years ago by dmethvin

Milestone: None1.7
Priority: lowblocker

comment:6 Changed 12 years ago by JorisDebonnet

Just curious: is it absolutely not an option to add mousewheel support to jquery (without addons)? A .mousewheelup() and .mousewheeldown() event would really look great on the list on http://api.jquery.com/category/events/mouse-events/ :)

After all, pretty much every mouse has a scrollwheel. jQuery already normalizes the event.which property, which is great; and it does the same for a keyboard's 'charCode'. In my opinion a mouse's scroll wheel is not so unusual: it's probably 99% as common as a keyboard and a mouse (even laptops have it). People use it all the time, and many applications have a good use for it.

Does it not deserve the same attention as the mouses' and keyboards' events?

Last edited 12 years ago by JorisDebonnet (previous) (diff)

comment:7 Changed 12 years ago by JorisDebonnet

As for the original issue: I changed the original fiddle to exclude the addon. This way perhaps it's easier to test against.

http://jsfiddle.net/Ly9x3/5/

It is using 1.6.4, so change to jQuery (edge) to see it break.

Last edited 12 years ago by JorisDebonnet (previous) (diff)

comment:8 Changed 12 years ago by anonymous

It also appears that $.event.handler has been renamed $.event.dispatch - by changing the references in the plugin from event to orgEvent and changing the return value to $.event.dispatch.apply(this, args); The plugin starts working again

comment:9 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

I've put together a patch that seems to work and submitted it to Brandon:

https://github.com/brandonaaron/jquery-mousewheel/pull/15

My (hopefully) fixed copy is here if you'd like to try it, please let me know if you have any issues:

https://raw.github.com/dmethvin/jquery-mousewheel/fix-17-origEvent/jquery.mousewheel.js

@JorisDebonnet: That test case is not quite right since you are looking at the jQuery normalized (fixed) event object and not the native browser event.originalEvent object that has the browser-specific mousewheel values. Our goal here is to avoid copying properties that only the plugin needs.

comment:10 in reply to:  9 Changed 12 years ago by cousins217

With your version I get: Uncaught TypeError: Cannot call method 'apply' of undefined ($.event.handle is undefined at least in the latest Chrome)

The version you posted needs:
return $.event.handle.apply(this, args);

changed to
return $.event.dispatch.apply(this, args);

And that seems to get things working again in 1.7 - it will however break < 1.7. I am not sure why handle went and dispatch came in but I imagine its to do with some 1.7 refactoring.

Replying to dmethvin:

I've put together a patch that seems to work and submitted it to Brandon:

https://github.com/brandonaaron/jquery-mousewheel/pull/15

My (hopefully) fixed copy is here if you'd like to try it, please let me know if you have any issues:

https://raw.github.com/dmethvin/jquery-mousewheel/fix-17-origEvent/jquery.mousewheel.js

@JorisDebonnet: That test case is not quite right since you are looking at the jQuery normalized (fixed) event object and not the native browser event.originalEvent object that has the browser-specific mousewheel values. Our goal here is to avoid copying properties that only the plugin needs.

comment:11 Changed 12 years ago by dmethvin

Sorry, I should have also specified that you must use the git version instead of rc1, it's at http://code.jquery.com/jquery-git.js .

comment:12 Changed 12 years ago by heylinus@…

Not working in Firefox on MacOSX console.log(delta, deltaX, deltaY); outputed: 0 0 0

jquery 1.7 jquery-mousewheel git firefox 7.0.1 mac os x 10.6.6

Also has the same problem in Firefox 7 & Opera 11.50 on Windows XP.

webkit(chrome, safari) is fine.

comment:13 in reply to:  12 ; Changed 12 years ago by Rick Waldron

Replying to heylinus@…:

Not working in Firefox on MacOSX console.log(delta, deltaX, deltaY); outputed: 0 0 0

jquery 1.7 jquery-mousewheel git firefox 7.0.1 mac os x 10.6.6

Also has the same problem in Firefox 7 & Opera 11.50 on Windows XP.

webkit(chrome, safari) is fine.

Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:14 in reply to:  13 Changed 12 years ago by heylinus

Replying to rwaldron:

Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

http://jsfiddle.net/Ly9x3/1/

firefox 7.0.1 (Mac 10.6.6) 1.6.4 and lower working 1.7 and 'edge' return 0 0 0

firefox 7.0.1 (WinXP x86) 1.6.4 and lower return 1 0 1(-1 0 -1) no horizontal scroll 1.7, and 'edge' return 0 0 0

firefox 7.0.1 (Win7 x64) 1.6.4 and lower working 1.7, and 'edge' return 0 0 0

comment:15 Changed 12 years ago by dmethvin

You'll need an update to the mousewheel plugin; I put in a pull request to Brandon and you can track it here:

https://github.com/brandonaaron/jquery-mousewheel/pull/17

comment:16 in reply to:  15 Changed 11 years ago by anonymous

Replying to dmethvin:

You'll need an update to the mousewheel plugin; I put in a pull request to Brandon and you can track it here:

https://github.com/brandonaaron/jquery-mousewheel/pull/17

Works excellent in Windows Firefox and Mac

comment:17 Changed 11 years ago by anonymous

A fix for any script using the movement of the mousewheel is (where e is the event):

if(!e.detail && !e.wheelDelta){e = e.originalEvent;}

Note: See TracTickets for help on using tickets.