-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Add prefers-contrast support to page.emulateMedia . #34240
Comments
Hi Maria! I'm working on adding support for this. Reading up on |
Hi Simon! Thank you so much - I tried implementing this myself and got stuck on prefers-contrast: less in Webkit! TLDR: prefers-contrast: more only for 1.51 would be just fine. It used to be possible to trigger prefers-contrast: less on iOS, but it's not anymore. Apparently, sometimes a forced-colors mode will also trigger prefers-contrast based on the kind of theme the user chooses, but that is probably a less common and less important use case. My main concern is about respecting contrast preference (and testing the resulting code!) on platforms where forced-colors is not available, and prefers-contrast: more is all that is practically available there. |
Perfect, then I'll look at only |
🚀 Feature Request
Add
prefers-contrast
support topage.emulateMedia
.Example
Motivation
Supporting
prefers-contrast
inpage.emulateMedia
would enable automated checking for regressions in high- and low- contrast themes. This is distinct from the already-supported (thank you!!!)forced-colors
emulation: forced-colors ignores author-chosen colours in favour of colours specified by the user, whileprefers-contrast
allows the author to supply different CSS in response to a user-specified preference for high or low contrast.Emulating
prefers-contrast
is already possible in Chromium by using CDPSession, but not in Webkit. Since MacOS/iOS/iPadOS only provides the end user a way to specify a contrast preference but not a colour scheme, and Playwright does not provide a way to emulate prefers-contrast in Webkit, site authors currently have no way of checking for regressions for users with different contrast preferences on desktop Safari, iPhone, or iPad.Regressions in this area are unlikely to be caught incidentally, so they must be tested using time-consuming manual steps or missed. Adding
prefers-contrast
emulation would allow Playwright to save site maintainers even more time and catch even more errors before they make it to production and impact end users.The text was updated successfully, but these errors were encountered: