Giter Club home page Giter Club logo

scroll-animations's Introduction

Specification 'scroll-animations'

This repository has been migrated to CSSWG for further development.

Please file any new issues in here

scroll-animations's People

Contributors

birtles avatar dontcallmedom avatar graouts avatar majido avatar mantaroh avatar martine-dowden avatar saschanaz avatar stephenmcgruer avatar theres-waldo avatar travisleithead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scroll-animations's Issues

Wrap examples in `prefers-reduced-motion`

I posted a question about this spec to Twitter, and @rogerjohansson replied with a good suggestion.

All examples should wrap the code in prefers-reduced-motion: no-preference.

I think that's a terrific idea. I know it'd add extra lines of code to the spec, while adding no value to the spec writers or implementors, but it would go a long way in emphasizing to the web industry that they shouldn't deliver scroll-driven animations to people who don't want them / can't handle them — and that doing so is very simple.

Discussion on 'auto' value for ScrollDirection

This question came up during the Chromium implementation of ScrollTimeline. The definition of orientation states:

"auto
If only one direction is scrollable, selects that direction. Otherwise selects the direction along the block axis."

The definition of 'scrollable', however, is causing some disagreement. I had initially assumed that it meant that the CSS overflow property in the given axis is non-visible, however per the CSS3 box spec it is not possible to have one axis be visible and the other non-visible:

"The computed values of ‘overflow-x’ and ‘overflow-y’ are the same as their specified values, except that some combinations with ‘visible’ are not possible: if one is specified as ‘visible’ and the other is ‘scroll’ or ‘auto’, then ‘visible’ is set to ‘auto’."

What is the intended definition of 'scrollable' here?

Spec incorrectly claims scrollSource cannot be null

Consider this testcase:

<script>
  document.documentElement.remove();
  var x = new ScrollTimeline();
  alert(x.scrollSource);
</script>

what should get alerted? Spec says "the document element of the active document for the current browsing context, as determined at the time the ScrollTimeline is constructed", but that's null in this case. But the scrollSource attribute claims its value is never null.

Should scrollSource == null cause a fall back to the document scrollingElement, rather than document element?

Currently the spec for scrollSource says (https://wicg.github.io/scroll-animations/#dom-scrolltimeline-scrollsource):

"If this is not specified, the document element of the active document for the current browsing context, as determined at the time the ScrollTimeline is constructed, is used."

It seems to me like this should probably fall back to document.scrollingElement (https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement) instead?

horizontal/vertical should specify whether they follow the direction/writing-mode

Currently vertical and horizontal are specified as:

horizontal
    Selects the horizontal direction.
vertical
    Selects the vertical direction

When writing-mode and direction are specified however, this can cause the beginning edges of an overflow region to be at the right/bottom.

It is not clear from the spec whether in these cases the orientation vector should also start from the right/bottom, or should stick with the physical top/left. The naive thinking is yes it should, but that only works if one is animating logical properties - consider what might happen if you animate transform: translateX(...). (The logical/physical issue is sort of a larger meta issue which I will file another issue about. This particular issue is about the fact that the spec doesn't make it clear what the horizontal/vertical directions are in the face of rtl.)

For an example, see https://output.jsbin.com/ruterik . This can be run in Chrome M71 (currently Canary) with the Experimental Web Platform Features flag on. It will show that we currently do follow the writing direction for horizontal/vertical, but it's not clear whether this is correct by the spec.

Scroll range of scroll timeline should be inclusive of endScrollOffset

The spec currently makes it so that the end offset produces unresolved time. See current time algorithm.

If current scroll offset is greater than or equal to endScrollOffset, return an unresolved time value if fill is none or backwards, or the effective time range otherwise.

This seems like an non-intuitive choice to me. In particular, if the user doesn't specify start, and end values then the interval becomes the whole scroll range. With current specified behavior at the max scroll offset the effect will become in-active unless it has a fill forwards value.

Also AFAICT web-animation active interval is inclusive of both start and end. So it feels like ScrollTimeline behavior should be altered to match that.

Fix for https://github.com/WICG/scroll-animations/issues/5 introduced a security bug

https://wicg.github.io/scroll-animations/#dom-scrolltimeline-scrollsource says:

If this is not specified, the document element of the active document for the current browsing context, as determined at the time the ScrollTimeline is constructed, is used.

But the document element of the active document of whatever may not even be same-origin with the code constructing the ScrollTimeline. So hooking up the ScrollTimeline to it looks to me like a cross-origin information leak.

When should orientation = 'auto' be resolved?

This question came up during the Chromium implementation of ScrollTimeline. The definition of orientation states:

"auto
If only one direction is scrollable, selects that direction. Otherwise selects the direction along the block axis."

However it isn't explicit about when this direction should be selected. If a ScrollTimeline is constructed as follows:

var timeline = new ScrollTrigger({ scrollSource: scroller, orientation: "auto" })

When should the orientation = 'auto' be resolved - at construction time, or every time currentTime is called? (Possibly changing from block to inline in the latter case, e.g. if the scroller content changes).

Mention design constraint of not blocking scrolling?

Depending on exactly how your interpret it, the avoiding cycles section implies that scrolling may need to block on JavaScript / layout.

For blink (and probably also at least Edge) that is a non-starter. Ensuring scrolling never blocks on the main thread has been our #1 scroll performance effort for several years, we're unwilling to allow that without an explicit scary-sounding opt-in API and a mitigation strategy (eg. "intervention" that applies on sites whose performance isn't good enough to permit a reasonable user experience on low end phones).

Is there agreement on this non-blocking design constraint for scroll animations? If so, perhaps it's worth mentioning in the introduction somewhere?

/cc @majido @flackr @shans

Start == End scroll offsets can lead to division by zero

It is possible to have start and end offset that are equal. This can lead to a division by zero when calculating currentTime. The spec should explicitly call this out and return early before trying to compute current time. I think a sensible option is to return undefined in this case.

(current scroll offset - startScrollOffset) / (endScrollOffset - startScrollOffset) × effective time range

What is a "current browsing context"?

https://wicg.github.io/scroll-animations/#dom-scrolltimeline-scrollsource talks about "active document for the current browsing context". What is a "current browsing context"? The link is to the definition of "browsing context", but what does "current" mean in this context?

There are concepts like "current Realm", "current settings object", and "current global object" defined at https://html.spec.whatwg.org/multipage/webappapis.html#current but none of those are defining "current browsing context".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.