Re: [csswg-drafts] [mediaqueries] Effect of <meta name=color-scheme> on the (prefers-color-scheme) MQ (#10249)

> Right, so those would be unaffected in your logistics.

Indeed. But if the `<meta name="color-scheme">` does start affecting `prefers-color-scheme`, we're going to want to start using it to force some pages to a certain colour scheme, and that will affect the analytics. (But if there is an alternative API we can use to get the user's preference by the time this is implemented in browsers, we can easily switch to that.) But that's just the BBC. @mayank99 is concerned about other websites where their scripts are reliant on `prefers-color-scheme` always reflecting the user's preference:

> Then it's a moot point. There is a lot of JavaScript code out there that relies on `matchMedia` to get the original OS preference. If `matchMedia` suddenly starts being affected by `<meta name="color-scheme">`, then it can break all this code.

So I guess the question is: how bad would the impact of this change be if it does 'break all this code'? I've brought up the analytics use case but maybe there are others? Would it actually be a problem?

The counterargument to that is: if an author is setting an explicit colour scheme by setting `<meta name="color-scheme" content="dark">`, then they're unlikely to need to query `prefers-color-scheme` in a script (except for analytics).

@mayank99, do you have any other use cases in mind that you're concerned about?

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


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

Received on Saturday, 24 August 2024 01:56:04 UTC