w3c / predefined-counter-styles

Predefined Counter Styles
https://w3c.github.io/predefined-counter-styles/
Other
7 stars 14 forks source link

Make some local counter styles the default for some of the languages #65

Open ebraminio opened 1 month ago

ebraminio commented 1 month ago

I think it could be great if user-agent stylesheet could make some of the defined counter styles as the default for some of the languages (or maybe under some pseudo class / meta tag?) basically integrating this source file from MediaWiki/Wikipedia to the user-agent stylesheet.

This makes ordered list numbers aligned with JavaScript's (123).toLocaleString('fa') that returns ۱۲۳,

Testcase: data:text/html,<html dir=rtl lang=fa><ol><li>1<li>2<li>3</ol>

data:text/html,<html dir=rtl lang=fa><ol><li>1<li>2<li>3</ol><style>ol:lang(fa) li { list-style-type: persian; }</style>

Expected: Both to be same

Actual: User-agent stylesheet doesn't contain that language specific styles.

Maybe like the way charset or dark mode is supported <meta name="color-scheme" content="light dark"> to be exposed only under some special meta tag, and maybe not.

r12a commented 2 weeks ago

This seems to be related to https://github.com/w3c/csswg-drafts/issues/7959

r12a commented 2 weeks ago

I have some reservations about relying on the browser to automatically substitute the desired counter style. These are just thoughts off the top of my head, so feel free to disagree.

  1. Preferences for which counter style to use when there are multiple alternatives could mean that you'd end up having to override what the browser is trying to do. This is particularly the case for separators, which not only vary according to author preference, but may need to vary according to embedding level or other contextual factors. So authors may need to specify the styles themselves quite often, because the default, say, Persian style is no better than the ASCII digit style.
  2. Preferred counter styles may vary within a given language. For example, authors writing Arabic text in Morocco may prefer ASCII digit counters, whereas authors in the gulf states may prefer arabic-indic digits. The user agent may be able to specify this using combinations of lang-region tags, but there'd be a lot of those, and i'm not confident the UA would successfully make such distinctions.
  3. I can see the appeal of this approach for a very multilingual site such as Wikipedia, but i suspect that most content authors would find it easy enough to manage styling for the languages they are dealing with.