Javascript: Horizontal mouse wheel scroll event indistinguishable from vertical event




11 years ago
11 years ago


(Reporter: avih, Unassigned)


Firefox Tracking Flags

(Not tracked)





11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

While enumerating the properties of DOMMouseScroll events, there's no apparent difference between horizontal wheel event and vertical wheel event (see test page here: . It enumerates all properties other than capital-constants, values that begin with "function" and values that begin with "[").

The "detail" property seems to reflect the "numlines" user preference for horizontal/vertical wheel scroll.

It has been reported that on some systems, if the value of e.detail is 32768 or -32768, then it indicates a horizontal event. This however, doesn't work on all systems (and I don't have the exact details as for the systems it worked on).

It seems as if internally, Firefox can distinguish H from V event according to the value of "scrollFlags" (value of 2 indicates a horizontal event). It seems to me as if this value isn't propagated to the event which the handler catches.

Reproducible: Always

Steps to Reproduce:
1. On the test page, scroll the vertical mouse wheel up/down
2. On the test page, scroll the horizontal mouse wheel left/right

Actual Results:  
No property reflects that the scroll is of different orientation

Expected Results:  
I would have expected one of the event properties to reflect this difference. Either a bit of the "details" property whos mask is a constant property (i.e. HORIZONTAL) or an actual boolean property, similar to altKey or shiftKey, i.e. isHorizontal

I have tested this on Windows and OSX.

Comment 1

11 years ago
One more comment regarding the +/- 32768 as a possible indicator: It probably isn't one.

I've tested the value of e.detail with various mouse system settings (only on Windows XP). I've found that the detail value is either the commutative number of lines configured on the mouse control panel of windows (i.e. if the mouse wheel is configured to scroll 4 lines then e.detail will be mostly 4 or -4 according to the direction. But if fast wheel events are fired, then it might be 8 or 12 etc according to the number of wheel scrolls the specific event represents). e.detail will be +/- 32768 if the mouse wheel should perform a full page scroll.

So the assumption that +/-32768 represents a horizontal scroll on some system is probably due to specific system configuration of the mouse wheel on that system, and probably isn't a general representation of horizontal scroll.

Closed: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 378028
You need to log in before you can comment on or make changes to this bug.