W3C home > Mailing lists > Public > www-style@w3.org > May 2014

Re: [css-counter-styles] allow use of CSS4 "alt" property with @counter-style/symbols

From: Reece Dunn <msclrhd@googlemail.com>
Date: Thu, 15 May 2014 11:50:06 +0100
Message-ID: <CAGdtn24Lu2C9402BX0MaPdTwYtEAUTu-wwoe4e+SOe41UUSWMA@mail.gmail.com>
To: James Craig <jcraig@apple.com>
Cc: Xidorn Quan <quanxunzhen@gmail.com>, Alexander Surkov <surkov.alexander@gmail.com>, David Bolter <dbolter@mozilla.com>, www-style list <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
On 15 May 2014 10:34, James Craig <jcraig@apple.com> wrote:
> Inline. cc Alex and David for the Firefox Accessibility question.
>
> On May 15, 2014, at 1:47 AM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
>
>> On Thu, May 15, 2014 at 11:36 AM, James Craig <jcraig@apple.com> wrote:
>>> Speak-as may account for some simple cases (like the numeric example below), but does not allow authors to designate alternative text for the symbol-based markers. If you just want numeric markers, there's no reason to use "symbols" at all.
>>>
>>> The following example is admittedly contrived, but is a better illustration of what cannot be accomplished with the "speak-as" property.
>>>
>>>     symbols: ◰ ◳ ◲ ◱;
>>>     alt: 'foo' 'bar' 'baz' 'bop';
>>>
>>> "speak-as" provides pretty good coverage of CSS 2's "list-style-type" property, but AFAICT it doesn't provide sufficient coverage of CSS3's "symbols" property.
>>
>> Actually, it can do what you want it to do. Consider this:
>>
>> @counter-style a {
>>   system: fixed;
>>   symbols: ◰ ◳ ◲ ◱;
>>   speak-as: b;
>> }
>>
>> @counter-style b {
>>   system: fixed;
>>   symbols: foo bar baz bop;
>>   speak-as: alphabetic;
>> }
>
> That's interesting, if somewhat convoluted. Do others in the group think this is preferable to extending CSS4 alt? The single block seems much more elegant to me.
>
> @counter-style a {
>   system: fixed;
>   symbols: ◰ ◳ ◲ ◱;
>   alt: "foo" "bar" "baz" "bop";
> }

How would that work with additive-symbols (e.g. roman numerals,
armenian and hebrew)? For example:

@counter-style unicode-upper-roman {
    system: additive;
    additive-symbols: 5 Ⅴ, 4 Ⅳ, 1 Ⅰ;
    alt: "a", "b", "c";
}

Would alt apply (Ⅴ => "a", Ⅳ => "b", Ⅰ => "c") in this case? Would
that make sense in this case? If it is equivalent to symbols, it would
be invalid in this case as the additive system does not use symbols.
Compare to:

@counter-style unicode-upper-roman {
    system: additive;
    additive-symbols: 5 Ⅴ, 4 Ⅳ, 1 Ⅰ;
    speak-as: upper-roman;
}

Here, there is a clear chain of meaning in how to interpret the
counter style. The same applies for using number-like styling, e.g.:

@counter-style counting-rod {
    system: numeric;
    /* NOTE: This example does not account for the tens counting rod symbols. */
    symbols: 〇 𝍠 𝍡 𝍢 𝍣 𝍤 𝍥 𝍦 𝍧 𝍨;
    speak-as: numeric;
}

This will speak the counting-rod style as numbers in the correct language.

Anything you can do with counter styles can be used to express
speak-as rules, so is more flexible than a single alt property.

It also allows you to specify the context of the counter style -- e.g.
as the unicode-upper-roman references the upper-roman counter style, a
screen reader/text-to-speech program could read them as "roman numeral
14", etc.. With the alt property, the screen reader does not have this
information.

Given:

@counter-style counting-rod {
    system: numeric;
    symbols: 〇 𝍠 𝍡 𝍢 𝍣 𝍤 𝍥 𝍦 𝍧 𝍨;
    alt: "0", "1", "2", "3", "4", "5", "6", "7", "8", "9";
}

The screen reader would be forced to read digit by digit, as it does
not know from the context that this is a number system and can use the
document's language (e.g. my hexadecimal example below, or an octal or
binary counter-style).

The counter style system also allows for things like:

@counter-style hexadecimal-spoken {
    system: override decimal;
    prefix: "hexadecimal ";
}

@counter-style hexadecimal {
    system: numeric;
    symbols: 0 1 2 3 4 5 6 7 8 9 A B C D E F;
    speak-as: hexadecimal-spoken;
}

So you get things like "hexadecimal 24". NOTE: In this example, you
would still need to be able to localize the prefix string, which is
not currently supported by counter-styles.

Thanks,
- Reece H. Dunn [http://reecedunn.co.uk]
Received on Thursday, 15 May 2014 10:50:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:51:27 UTC