[Bug 29276] New: Expose modern 'wheel' event parameters (inertial scrolling, direction inversion)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29276

            Bug ID: 29276
           Summary: Expose modern 'wheel' event parameters (inertial
                    scrolling, direction inversion)
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DOM
          Assignee: annevk@annevk.nl
          Reporter: loren.brichter@gmail.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, www-dom@w3.org
  Target Milestone: ---

Current DOM 'wheel' events only expose bare-minimum data (deltaX, deltaY) that
don't fully capture how modern scrollwheels and trackpads behave.

Exposing two additional pieces of information would greatly improve the
possibilities for interesting and important custom event handling.

1. Inertial-scroll events. For example, on many modern trackpads, "throwing"
your fingers results in two distinct phases of scrolling. First, while your
fingers are in contact with the trackpad *real* scroll events are delivered
corresponding to your finger motion. Second, once your finger(s) leave the
surface, a stream of scroll events are *synthesized* corresponding to the
velocity of your fingers at the end of phase I.

For many applications it is vital to be able to distinguish between *real* and
*synthetic* scroll events (e.g. to perform custom scroll handling with
different physics parameters or boundary cases, where naive system-provided
friction falloff will not suffice). Native event APIs expose this information
and I propose that browsers could expose it through new WheelEvent properties.

Developers have come up with horrible hacks to work around not having this
information (see https://libraries.io/npm/lethargy and weep).

2. Direction-inversion. Users may "invert" the direction of scrolling
(conceptually the "page" moves in the same direction as their fingers vs. the
"scrollbar" moves in the same direction as their fingers). Unfortunately this
setting is not exposed to developers, and it would be useful to know whether
given scroll deltas mirrored the users real-world finger motion.

Again, native APIs expose this information, and it would be extremely useful to
have access to it in the browser in cases where scrolling gestures are
interpreted as something other than 2D scrolling, (3D navigation for example).

If I may humbly propose exposing a few additional properties on delivered DOM
wheel events:

interface WheelEvent : MouseEvent {
...
+    readonly    attribute boolean       isInertialScrolling;
+    readonly    attribute boolean       directionInvertedFromDevice;
};

inertialScrolling of type boolean, readonly
  true if the event is the result of a synthetic inertial native scroll event
  false otherwise
directionInvertedFromDevice of type boolean, readonly
  true if the signs of deltaX and deltaY are reverse the user's physical
scrolling direction
  false otherwise

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 10 November 2015 21:47:46 UTC