Re: [csswg-drafts] [scroll-animations] Broader scope of scroll timelines (#7759)

What’s the default value for `scroll-timeline-root`? If it’s `none` then it doesn’t really rhyme with the shorthand. Compare these two that both set the same values but have a different resulting `scroll-timeline-root`:

- `scroll-timeline: foo block;` => `scroll-timeline-root: foo; scroll-timeline-name: foo; scroll-timeline-axis: block;`
- `scroll-timeline-name: foo; scroll-timeline-axis: block;` => `scroll-timeline-root: none; scroll-timeline-name: foo; scroll-timeline-axis: block;`

If it does the "search for an ancestor establishing a root of the same name, and if that fails, create a root on yourself" then feels more like that would be something that’s better represented by an `auto` keyword?

Iterating on that, `scroll-timeline-root` could be `[ auto | none | <custom-ident> ]#`:

- `auto`: Declare a STL with same ident as the `-name` property has set. The resulting STL will be local + subtree only. In case no `-name` is set on the element, this declaration has no effect.
- `none`: Don’t declare. A STL defined with `-name` will try and attach to a parent that has `-root` set to the same ident.
- `<custom-ident>`: Declare STL with given ident. Children with the same ident set as their `-name` *and* `-root` set to `auto` will attach to this.

Put differently: A `scroll-timeline-name` always wants to attach to a `scroll-timeline-root` with the same ident. If the `-root` is `auto`, the magic of the engine will make sure the `-root` is set to the `-name`’s ident. In case of `-root` set to `none`, the defined STL via `-name` will be forced to look up the ancestor tree to attach to a `-root` with that ident (so not `auto` and not `none`).

_(`<custom-ident>` to be replaced by `<dashed-ident>` if other issue is resolved)_

Shorthand-wise, it would then be:

- `scroll-timeline: foo block;` => `scroll-timeline-root: auto; scroll-timeline-name: foo; scroll-timeline-axis: block;` ~> `scroll-timeline-root: foo; scroll-timeline-name: foo; scroll-timeline-axis: block;`
- `scroll-timeline-name: foo; scroll-timeline-axis: block;` => `scroll-timeline-root: auto; scroll-timeline-name: foo; scroll-timeline-axis: block;` ~> `scroll-timeline-root: foo; scroll-timeline-name: foo; scroll-timeline-axis: block;`
- `scroll-timeline: foo block ancestor;` => `scroll-timeline-root: none; scroll-timeline-name: foo; scroll-timeline-axis: block;`

Or instead of `ancestor` it could simply be replaced by any of the `scroll-timeline-root` values.

I think that would make sense, as the short and longhands don’t have different effects. 

_(Haven’t re-checked the entire thread, but I feel this might have been proposed at a certain point in time and/or we might be saying the same thing and I didn’t grasp it entirely before 😅)_

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7759#issuecomment-1527247952 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 28 April 2023 09:16:04 UTC