← Back to release summary

visualViewport.onscrollend Support

Category
JavaScript
Type
Chromium catches up
Status
Enabled by default (Chrome 126)
Intent stage
None

Summary

Scrollend is a JavaScript event that fires to signal that a scrolling operation has come to an end. Similar to the Element interface[1], the visualViewport interface[2] includes an onscrollend event handler that should be invoked when a scrolling operation on the visualViewport has ended. Chromium already supports adding a scrollend event listener via `visualViewport.addEventListener("scrollend")`. This just makes it possible to also add an event listener using `visualViewport.onscrollend`. [1]https://html.spec.whatwg.org/multipage/webappapis.html#handler-onscrollend [2]https://drafts.csswg.org/cssom-view/#dom-visualviewport-onscrollend.

Motivation

Scrollend events allow developers add event listeners which are invoked when a scrolling operation comes to an end. The visualViewport can be scrolled as well and supports listening for scrollend events. This feature is specifically to support the visualViewport.onscrollend interface. Supporting the visualViewport.onscrollend method allows developers use the common and convenient pattern of `visualViewport.onscrollend = (event) => { doStuff() }` pattern in addition to the already-supported `visualViewport.addEventListener`.

Standards & signals

View on chromestatus.com