Open vitorroriz opened 1 year ago
to quote @jfkthame in the WPT issue:
That's interesting ... and I think is a questionable feature.
See the Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1808995 for an example where the reporter expected (quite reasonably, IMO) that the suffix should be taken from the fallback counter-style that is actually used to generate the representation. Not doing this seems unexpected/illogical, IMO.
As an aside, I also missed the note quoted above when I first looked at this—because the first place I looked at was the definition of the fallback
descriptor, which I would've expected would've (at least informatively) pointed out the fallback is partial.
I didn't have a particularly great reason to define it that way, except that it seemed simpler at the time. Happy to adjust things if browsers prefer to align these things.
I didn't have a particularly great reason to define it that way, except that it seemed simpler at the time.
To me, it seems confusing rather than simpler. If the range of a @counter-style
rule excludes the value being represented, its fallback
applies. fallback
references another counter style. It's unnatural to expect it to reference only certain aspects of the fallback style and not the style as a whole.
Happy to adjust things if browsers prefer to align these things.
Given the lack of clear motivation for the "partial-fallback" interpretation, and that we received a specific bug report (https://bugzilla.mozilla.org/show_bug.cgi?id=1808995) relating to this (with a real-world use case), I think we should indeed adjust this.
I meant simpler to define - it means I can just reuse the algorithm that generates the string for counter()
(which does not communicate which counter-style it eventually uses). (And this also means we're not invoking magic that's not available to authors - they'd have no way to produce a 'content' value matching what the browser does, if we made this change.)
The CSS Working Group just discussed [css-counter-styles-3] Should fallback use prefix/suffix of original style or fallback style?
, and agreed to the following:
RESOLVED: No change to current spec. Draft ability for a counter function to return the counter string including prefix/suffix, with various fallback options
@tabatkins One thing I notice in the minutes is your suggestion of using an additive style to achieve what the reporter was trying to do:
<TabAtkins> @counter-style ordinal { system:additive; additive-symbols: 900 "9", 800 "8", ..., 90 "9", ..., 9 "9th", ..., 1 "1st"; }
<TabAtkins> actually that's way shorter than what the bug reporter was trying to do
However, unless I'm missing something, I don't think that actually works, does it? AFAICT this would fail for things like 900
, which just generates "9" and doesn't produce any trailing zeros or the desired "th". Similarly, 901
would generate "91st", because the additive style has no reason to produce a zero in the middle.
Yes, you're right, and it's an issue I noticed in the past when trying to use additive to do things like this. I ended up considering it niche enough to not need addressing, since it would complicate the additive syntax significantly, and the existing real-world additive systems didn't use it (they do indeed skip digits with 0 value).
We'd probably want a more explicit generation form that was explicitly base-N and took a list of symbols to use for each digit in a given place.
Or just have another descriptor that appends to the generated representation, to address the use-case more directly.
Hi everybody,
Counter styles specification says at https://www.w3.org/TR/css-counter-styles-3/#counter-styles:
However, some related WPT tests (below) expects that the suffix and prefix come from the fallback style: imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/suffix-fallback.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/system-additive.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/system-alphabetic.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/system-extends.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/system-symbolic.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/fallback-cycle.html imported/w3c/web-platform-tests/css/css-counter-styles/counter-style-at-rule/descriptor-prefix.html
I've created a related issue at the WPT repo (https://github.com/web-platform-tests/wpt/issues/38772) since there were related changes to the expected values here https://github.com/web-platform-tests/wpt/commit/90a953f4c4f0235160e96c8dd27d4a5e7638511d
I'd like to clarify what the proper behavior should be.