Enabling scroll customization

Hi,

In order to implement UI effects which customize or respond to scrolling,
some developers currently resort to re-implementing scrolling
<http://cubiq.org/iscroll-5>. This is bad for three reasons:

1. It doesn’t take advantage of the threaded scrolling optimizations most
browser have (just like all other effects that handle input directly today).

2. Matching browser scrolling exactly is very difficult or impossible.

3. It doesn’t compose correctly with other native or JavaScript driven
scrollers.

We (the blink team) have come up with a rough proposal
<https://docs.google.com/document/d/1oEVWIVdMZ2OlVZMvcZZ3IgaT6RAUNSKAzpzb9AlVeLw/edit?usp=sharing>
for a synchronous “beforescroll” event which seeks to address #2 and #3,
enabling high quality scroll customization effects in JavaScript. It does
not attempt to address #1, which we feel is orthogonal.

Increasingly, our experience is that it's possible to build 60fps web
applications that rely on running JavaScript for each frame, and we intend
this feature to be used ONLY by applications that have done the work
necessary to achieve this level of performance.

The beforescroll event would enable many scenarios which previously
required re-implementing scrolling or using specialized browser features,
such as position: sticky
<http://dev.w3.org/csswg/css-position-3/#sticky-positioning>, scroll header
panels
<http://www.polymer-project.org/docs/elements/core-elements.html#core-scroll-header-panel>,
snap points
<http://msdn.microsoft.com/en-us/library/ie/hh772036(v=vs.85).aspx>, hidey
bars <http://lists.w3.org/Archives/Public/www-style/2014Feb/0804.html>, pull
to refresh
<https://docs.google.com/a/chromium.org/document/d/1cBYKZMCeeaT6pN3VYu9uox8AXbJKmOaEmpL4BTg5lT4/edit#bookmark=id.loyu3kqzz1ir>,
scroll-chaining
<http://msdn.microsoft.com/en-us/library/windows/apps/hh466007.aspx> and
scroll-limit
<http://msdn.microsoft.com/en-us/library/ie/jj127336(v=vs.85).aspx>.

We believe that providing low level primitives in addition to specialized
browser features will lead to a more extensible web
<http://extensiblewebmanifesto.org/>, and the beforescroll event is a
powerful low level primitive. This has informed our perspective on snap
points <http://lists.w3.org/Archives/Public/www-style/2014Feb/0769.html>,
and continues to impact our view of adding other specialized browser
features.

Is there any interest here in discussing an API like this? We expect that
the API specifics will evolve significantly as we start to experiment with
an implementation and receive feedback.

Thanks,
Tim Dresser

Received on Thursday, 18 September 2014 17:00:29 UTC