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

@JoshTumath @tabatkins My main point is that `matchMedia` is a reliable way to get the user's preferred color-scheme today. If it suddenly starts changing based on the markup, then it is no longer reliable. 

Often times, the HTML and JS are not even written by the same author. The JS might even be coming from a third-party script or a browser extension. Can you really be sure that nothing will break with this change? To illustrate this point, I've created an [example](https://dark-frog-30.deno.dev) that would break if such a change was to ship (you can view-source and see `<meta name="color-scheme">` in the `<head>` and `matchMedia` in the `<script>` at the bottom).

I'm not necessarily opposed to the proposed behavior (even though I personally feel it makes things more confusing), but I think that ship has sailed. The right time to make this change would have been five years ago before `color-scheme` started shipping in browsers.

---

@bramus Style queries do help with deduplication. The key is to also set the actually property based on the `prefers-color-scheme` query. I've created an [example](https://full-badger-55.deno.dev/) using custom property style queries that you can inspect.

(Also `light-dark()` is a great way of solving deduplication)

-- 
GitHub Notification of comment by mayank99
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10249#issuecomment-2308427926 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 15:18:09 UTC