Decoding Mac Touchpad Scroll Events: Wheel, Mousewheel, and Inertia Insights
This article explores how Mac touchpads generate the same scroll events as mouse wheels, analyzes the key parameters of mousewheel, wheel, and DOMMouseScroll events, examines inertia and pinch‑to‑zoom behaviors, and offers practical guidance for handling performance issues in web applications.
What events does the touchpad trigger?
When using a Mac to browse typical web pages, scrolling with the touchpad generates the same events as a mouse wheel: mousewheel, wheel, and DOMMouseScroll. Browser support varies, and a compatibility table (image below) shows the situation for macOS.
Older development needed DOMMouseScroll for legacy Firefox, but its market share is now negligible, so it can be ignored. In practice, listening to both mousewheel and wheel covers all cases.
Event Parameter Analysis
Scroll events carry many parameters; the most relevant ones are highlighted in the following diagram.
Mac lets users set the scroll direction (Natural). When Natural is enabled, the page scroll direction matches finger movement, but the mouse wheel direction is reversed, which many users find unintuitive.
The table below (image) shows the sign of parameters under non‑Natural (Windows‑like) mode.
Notice that deltaY and wheelDelta have opposite signs.
Inertia Characteristics
During a fast swipe, the page continues scrolling after the finger lifts, creating an inertia effect. Both deltaY and wheelDelta reflect the traveled distance, and plotting them reveals a smooth curve that drops to zero at the moment of lift.
In Chrome and Safari the curve does not produce a zero‑value event at lift, making it appear more continuous. Repeated swipes before inertia ends start from zero again, and opposite‑direction swipes produce mirrored curves.
Key Observations
The absolute value of wheelDelta is consistently three times that of deltaY. Firefox’s wheel event lacks wheelDelta.
During continuous swipes and inertia, event intervals are typically under 20 ms, often around 17 ms, enabling a 60 FPS refresh rate (≈16.6 ms per frame).
If a new swipe begins before the previous inertia ends, the interval usually exceeds 20 ms.
Safari provides webkitDirectionInvertedFromDevice, which is true when the system is in Natural mode.
Pinch‑to‑Zoom
Only browsers based on the Chrome engine can capture pinch‑to‑zoom gestures on the touchpad. The resulting curves show a stable wheelDelta of 120 while deltaY hovers near zero (negative for zoom‑in, positive for zoom‑out).
Practical Issues Encountered
In a simple demo page the data is clean, but real‑world applications (e.g., maps with 3D‑accelerated animations) suffer performance degradation, causing jitter in deltaY and wheelDelta values and longer intervals between events.
When the map’s zoom animation is removed, the parameter curves become smooth again.
Conclusion
Jitter in scroll‑event parameters can mislead state detection, causing inertia to be mistaken for a new user action. Effective handling therefore requires both thorough analysis of event‑parameter characteristics and careful attention to page performance during scrolling interactions.
Baidu Maps Tech Team
Want to see the Baidu Maps team's technical insights, learn how top engineers tackle tough problems, or join the team? Follow the Baidu Maps Tech Team to get the answers you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
