[csswg-drafts] [scroll-animations-1] Three-value `animation-range` shorthand notation (#8672)

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [scroll-animations-1] Three-value `animation-range` shorthand notation ==
Currently `animation-range` is [defined with the following syntax](https://drafts.csswg.org/scroll-animations-1/):

```
animation-range: [ <<'animation-range-start'>> <<'animation-range-end'>>? ]#
```

We added the following rules:
* In the longhands, as well as in the shorthand, if a range name is given but the offset is omitted, it defaults to 0% for -start and 100% for -end.
* In the shorthand, if the second value is omitted and the first value has a range name, it copies the range name from the first and takes a 100% offset. (The second value otherwise defaults to the initial value, `normal`).

What we didn't discuss was what happens if two offsets and a keyword were specified, e.g.

```
animation-range: contain 10% 90%;
animation-range: 10% contain 90%;
```

These don't fall under the special range-name duplication rules we decided in https://github.com/w3c/csswg-drafts/issues/8438, so the standard behavior that falls out is:

```
animation-range: contain 10% 90%;
animation-range-start: contain 10%;
animation-range-end: 90%;

animation-range: 10% entry 90%;
animation-range-start: 10%;
animation-range-end: contain 90%;
```

We have several options here:
* Assign the longhand values exactly as specified (see above).
* Extend the range name duplication rule to apply to also apply to double offset values.
    * In this case, such longhand combinations would not have a serialization in the shorthand, unless we made some more explicit serialization like “normal 10%” also valid and equal to “10%”. See [suggestion](https://github.com/w3c/csswg-drafts/issues/8438#issuecomment-1488270914) from @cdoublev.
* Make these types of values (two offsets, one keyword) invalid.

Imho, while making `contain 10% 90%` expand to `contain 10% contain 90%` seems nice, doing that for the analogous `10% contain 90%` makes a bit less sense, and I'm not sure that making “normal” act like a range is a good idea, since it's supposed to represent the absence of a range restriction... And making them invalid seems unnecessary work, since these syntaxes are normal consequences of a basic shorthanding relationship. So I'm inclined to go for the first option. Thoughts?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8672 using your GitHub account


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

Received on Monday, 3 April 2023 19:53:41 UTC