[uievents] Expose 'inertial scrolling state' in wheel events (#58)

Split from https://github.com/w3c/uievents/issues/56

Current DOM 'wheel' events only expose bare-minimum data (deltaX, deltaY) that don't fully capture how modern scrollwheels and trackpads behave. Exposing additional bits of information would greatly improve the possibilities for interesting and important custom event handling.

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).

I propose exposing an additional property on delivered DOM wheel events:

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

    isInertialScrolling of type boolean, readonly
      true if the event is the result of a synthetic inertial native scroll event
      false otherwise


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/58

Received on Thursday, 12 November 2015 15:47:13 UTC