W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [mediaqueries-5] duplication of `forced-colors: active` and `prefers-contrast: forced` (#5433)

From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
Date: Thu, 22 Oct 2020 03:52:49 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-714204143-1603338768-sysbot+gh@w3.org>
> What the difference is between using `@media (forced-colors: active) { }` and `@media (prefers-contrast: forced) { }`? It seems there is no difference. 

There's no difference indeed.

> So why is it easier for Authors to have two ways to write the same code?

It's not easier. I'm arguing for both because one of them shipped already so we cannot remove it (at least not easily), and because I see benefits in the other one.

> I see in the minutes the argument being raised that Authors will want to reduce visual complexity for both forced colors and for low/high contrast, so why not put it all in one MQ. To me that's like saying people will want to do things for phones, so why make them think through when to use a MQ for screen size vs a MQ for reduced-data? Let's just put the new prefers-reduced-data values into width, so Authors can use them at the same time.

My point is different in a subtle but important way: I don't want to group them so that authors **can** target all of these users with one query, but because I expect authors **will** write code that is applicable to all these users with that one query anyway, and asking authors to specifically remember to target a separate small demographic that would be well served by code they already wrote is unfortunate, because some/most of the time they'll forget, and these users will miss out.

In more details:

* Will some authors write styles for `@media (prefers-contrast: more)` -> yes
* Will some authors write styles for `@media (prefers-contrast: less)` -> yes
* Will some authors write styles for both -> yes
* When writing styles for both, will some authors refactor the common parts into `@media (prefers-contrast)` -> yes

When that happens, this common code will be applied to:
* users who have explicitly asked for more contrast
* users who have explicitly asked for less contrast
* users who have picked a forced color scheme that happens to be high or low contrast

The question is then: should it also apply to users who have picked a forced color scheme that is neither particularly high nor low contrast, or should we require authors to specifically remember that these people exist and to target them explicitly.

I'm saying that yes, it should apply, because the shared code is highly likely to be relevant, and authors are overall unlikely to remember to carter for this this relatively small user demographic. Those who do remember still have all the tools needed to tailor the style if a difference is needed, but getting things to work when you don't think about it too much has value. Accessibility gets better when users with similar enough needs are grouped together so that they benefit even when authors don't specifically remember them.

I do agree that from a conceptual point of view, forced colors and contrast preferences are different things, and it would be cleaner to have them be separate, which probably affect teachability. So there's a tradeoff. @jensimmons argues that we should pick author understandability over implementer convenience, and this calls for keeping `forced-color: active` over `prefers-contrast: forced`. I completely agree. But I think there are user benefits here that could outweigh the author concerns, and that this calls for the other way around.

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 22 October 2020 03:52:51 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:20 UTC