Bug 151093
Summary: | Expose modern 'wheel' event parameters | ||
---|---|---|---|
Product: | WebKit | Reporter: | loren.brichter |
Component: | UI Events | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Enhancement | CC: | bdakin, eoconnor, graouts, jonlee, loren.brichter, webkit-bug-importer, wenson_hsieh |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
loren.brichter
Current 'wheel' events only expose bare-minimum information (dx, dy) that doesn't fully capture how modern scrollwheels and trackpads behave.
Exposing two additional pieces of information would greatly improve the possibilities for interesting custom event handling.
1. Inertial-scroll events. For example, on the Mac, by checking if a native event's 'momentumPhase' == NSEventPhaseNone, one can easily filter out synthesized inertial scroll events and only capture "real" events. It is important to distinguish them if you need to do custom scroll handling (with different physics parameters or boundary cases, where naive system-provided damping will not suffice).
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. For example, on the Mac, by checking a native event's 'directionInvertedFromDevice' one can determine if scrolling deltas reflect the actual direction the user's fingers are moving on a trackpad. This is important to implement correct-feeling custom gesture handling (e.g. for non-2D-scrolling interactions).
If I may humbly propose exposing a few additional properties on delivered DOM events:
.[blink|webkit]ScrollingMomentumPhase : Possible values match those described by [1]. Developers can then easily filter out synthesized momentum events by ignoring all but 'PhaseNone' type events.
.[blink|webkit]ScrollingInverted : boolean reflecting the value described by [2].
Thanks for taking this into consideration.
[1] https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instp/NSEvent/momentumPhase
[2] https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/occ/instp/NSEvent/directionInvertedFromDevice
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
loren.brichter
Chromium bug: https://code.google.com/p/chromium/issues/detail?id=554012&thanks=554012&ts=1447168097
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1223414
Radar WebKit Bug Importer
<rdar://problem/23481214>
loren.brichter
W3C discussions:
https://github.com/w3c/uievents/issues/57
https://github.com/w3c/uievents/issues/58