Re: [csswg-drafts] [css-lists] `<reversed-counter-name> <integer>` seems useless (#6231)

>ol[reversed][start] {
>  counter-reset: list-item calc(attr(start integer) + 1); /* with reversed flag */
>}

I'm confused - how could that possibly work? - the computed value will be the same as a non-reversed counter since the "with reversed flag" isn't encoded in the computed value.  E.g. `<ol reversed start=8>` would have the same computed `counter-reset` value as `<ol start=10>`, right?  That doesn't make sense to me.  Also, we should definitely provide a way to express `<ol reversed start=8>` in pure CSS and map the HTML attrs to that.  No magic flags that can only be set by HTML please. So the first option is unacceptable IMO.

Your second suggestion is interesting, but I doubt it's web-compatible. I suspect there's a lot of existing content that use `<ol reversed>` together with explicit `counter-increment: list-item -1` (and other values), which would break if we change the meaning of the sign.

I tend to think we should keep the syntax as is. You're right that the `reversed()` keyword doesn't really do anything for the specific case you mention, except perhaps as for documentation purposes, but that seems like a minor issue. I think I prefer to keep the syntax/serialization uniform for all counters rather than introducing special cases. And who knows, maybe we'll find a use for the explicit `reversed()` in this case too in the future?  E.g. `counter-increment: c step(2)` which could mean `2` or `-2` depending on the context...

That said, in theory we could make a _default_ increment value for non-`list-item` counters be `1` or `-1` depending on context.  E.g.
```css
container { counter-reset: reversed(c) 7; }
item  { counter-increment: c; }
```
given that we don't have any backwards compat to worry about here.  That complicates the spec a bit though - which currently says the value defaults to `1`. It's also more for authors to learn since non-`list-item` default values would behave differently from `list-item`. I think simplicity/uniformity is probably preferable here too - after all it's just a "-1" to type out, and an explicit value is also clearer.

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


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

Received on Monday, 18 October 2021 12:34:17 UTC