respect-user-color-scheme enables checking of prefers-color-scheme media query#12426
Merged
gordonwoodhull merged 2 commits intomainfrom Apr 2, 2025
Merged
respect-user-color-scheme enables checking of prefers-color-scheme media query#12426gordonwoodhull merged 2 commits intomainfrom
respect-user-color-scheme enables checking of prefers-color-scheme media query#12426gordonwoodhull merged 2 commits intomainfrom
Conversation
e7c3714 to
48dcaaf
Compare
Member
Author
|
🗝️ When we test We don't have dynamic switching in Quarto (yet), so await page.emulateMedia({ colorScheme: "dark" });within a test won't work. |
665b0a2 to
03287fd
Compare
3 tasks
prefers-color-schema setting instead of author default
prefers-color-schema setting instead of author defaultprefers-color-schema setting instead of author preference
Member
Author
|
Seems to be dependency failure |
Member
|
Yes possibly a conflict between package that would require update. I'll look at it. |
prefers-color-schema setting instead of author preferenceprefers-color-scheme setting instead of author preference
a592a95 to
8b29a4a
Compare
prefers-color-scheme setting instead of author preferencerespect-user-color-scheme enables checking of prefers-color-scheme media query
…r default fixes #1470 respect-user-color-schema defaults to false use static tests for user default color scheme since we do not support dynamic change of prefers-color-scheme yet
8b29a4a to
98666c0
Compare
Member
Author
|
Still seeing those flextable / openssl errors. I'm going to merge - pretty sure my tests are not on any of those buckets. Curious that it only affects this branch and we haven't seen this elsewhere. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1470
When
respect-user-color-schemeis enabled (defaultfalse), user preference for color scheme will be read from the prefers-color-scheme media query.This mean that the author preference (via order of light and dark theme or brand in YAML) is unused, as long as JS is enabled. NoJS still uses stylesheet ordering based on author preference. 1
If the UI dark mode toggle is used, it gets saved to local storage and that take precedence. Currently the user can delete their local storage for the site to go back to their OS default, but in the future we might consider e.g. deleting the local storage setting if it matches the OS setting.
This doesn't do dynamic changes if the OS setting changes, so people who use Auto will have to refresh the page for now.
This tests correctly manually across browsers, but unfortunately it breaks automated tests in unexpected ways, and I haven't figured out how to fix those yet.In particular, I have tried Changing Color Scheme in Playwright Test to no avail.Footnotes
We might consider a grand refactor using proper media queries, but I am just finding my way around the code and haven't considered that yet. ↩