Page MenuHomePhabricator

Dark mode styles leak into printed media
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

In T366362 we restricted dark mode styles to the screen media and updated our recommendations on https://www.mediawiki.org/wiki/Recommendations_for_night_mode_compatibility_on_Wikimedia_wikis

This means all existing usages need to be updated.

User story

As a reader, I do not want dark mode styles leaking into printed content.

Requirements

Requirement

Verify that the CSS media query for prefers-color-scheme: dark is not present in the deployed code, except potentially within the Flow extension. This ensures that dark mode styles are not applied when printing, and the printed output remains in light mode.

To validate this, perform a search across the deployed codebase to confirm that @media (prefers-color-scheme: dark) yields no results outside of the Flow extension.

BDD

Given that dark mode is enabled,
When the user prints a page,
Then the printed media should appear in light mode with no dark mode styles applied.

Given that the deployed code is reviewed,
When a search is performed for the `@media (prefers-color-scheme: dark)` CSS query,
Then the query should yield no results outside of the Flow extension.

Test Steps

Test Case 1: Verify the absence of dark mode styles in the deployed code

  1. Perform a search in the deployed codebase using the link: https://codesearch.wmcloud.org/deployed/?q=%40media+%5C%28+prefers-color-scheme%3A+dark.
  2. AC1: Confirm that the search yields no results, except potentially within the Flow extension.

Test Case 2: Verify that print preview displays in light mode for multiple namespaces

  1. Enable dark mode in the user's settings.
  2. Navigate to the main page.
  3. Open the print preview for the page.
  4. AC2: The print preview should appear in light mode.
  5. Repeat steps 2-4 for the article namespace, talk page, and special page.
  6. AC3: Verify that the print preview in each of these namespaces also appears in light mode, regardless of dark mode being enabled on the screen.

Design

  • Add mockups and design requirements

Acceptance criteria

In general, pages should always appear in light-mode when printing. Dark-mode should be limited to screens. Although the changes span multiple repos, this behavior can be verified by looking at the print preview for multiple namespace.

  • On beta, verify that the print preview for multiple namespaces is in light mode. Check main page, article namespace, talk page, special page.

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

This task was created by Version 1.0.0 of the Web team task template using phabulous

QA Results - Beta

ACStatusDetails
1T371331#10060284
2T371331#10060284
3T371331#10060284

QA Results - Prod

ACStatusDetails
1T371331#10097479
2T371331#10097479
3T371331#10097479

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Jdlrobson renamed this task from Web Task Creation Form to Dark mode styles leak into printed media.Jul 29 2024, 9:41 PM

Change #1057961 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Echo@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057961

Change #1057963 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/PageTriage@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057963

Change #1057964 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/GrowthExperiments@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057964

Change #1057965 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/DiscussionTools@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057965

Change #1057964 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057964

ovasileva lowered the priority of this task from High to Medium.Jul 30 2024, 4:11 PM
ovasileva set the point value for this task to 2.
Jdlrobson raised the priority of this task from Medium to High.Jul 31 2024, 10:55 PM

Change #1060904 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/core@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060904

Change #1060906 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060906

Change #1057963 merged by jenkins-bot:

[mediawiki/extensions/PageTriage@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057963

Change #1060920 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/Vector@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060920

Change #1060904 merged by jenkins-bot:

[mediawiki/core@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060904

Change #1060906 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060906

Change #1057965 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057965

Change #1060928 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/WikimediaMessages@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060928

Change #1060929 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/Popups@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060929

Change #1060930 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/MobileFrontend@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060930

Change #1060920 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060920

Change #1057961 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Dark mode styles should not apply to printed content

https://gerrit.wikimedia.org/r/1057961

Change #1060928 merged by jenkins-bot:

[mediawiki/extensions/WikimediaMessages@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060928

Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: Jdrewniak.

Change #1060930 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060930

Change #1060929 merged by jenkins-bot:

[mediawiki/extensions/Popups@master] Prevent dark-mode styles from affecting print media

https://gerrit.wikimedia.org/r/1060929

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify the absence of dark mode styles in the deployed code

  1. Perform a search in the deployed codebase using the link: https://codesearch.wmcloud.org/deployed/?q=%40media+%5C%28+prefers-color-scheme%3A+dark.
  2. AC1: Confirm that the search yields no results, except potentially within the Flow extension.

Not sure if this is for beta, prod, or both

screenshot 3.png (734×1 px, 140 KB)

Test Case 2: Verify that print preview displays in light mode for multiple namespaces

  1. Enable dark mode in the user's settings.
  2. Navigate to the main page.
  3. Open the print preview for the page.
  4. AC2: The print preview should appear in light mode.

screenshot 8.png (957×1 px, 383 KB)

screenshot 7.png (957×1 px, 376 KB)

  1. Repeat steps 2-4 for the article namespace, talk page, and special page.
  2. AC3: Verify that the print preview in each of these namespaces also appears in light mode, regardless of dark mode being enabled on the screen.
ArticleTalkSpecial
screenshot 6.png (957×1 px, 406 KB)
screenshot 5.png (952×1 px, 417 KB)
screenshot 4.png (955×1 px, 461 KB)
screenshot 22.png (771×1 px, 240 KB)
screenshot 19.png (771×1 px, 270 KB)
screenshot 20.png (771×1 px, 286 KB)
screenshot 21.png (771×1 px, 309 KB)
screenshot 17.png (771×1 px, 292 KB)
screenshot 9.png (771×1 px, 267 KB)
screenshot 10.png (771×1 px, 295 KB)
screenshot 11.png (771×1 px, 310 KB)
screenshot 18.png (771×1 px, 390 KB)
screenshot 24.png (771×1 px, 275 KB)
screenshot 23.png (771×1 px, 331 KB)
Edtadros updated the task description. (Show Details)
Edtadros subscribed.
Jdlrobson claimed this task.

We assessed the reverted patch on Slack today and determined there is no need to follow up.

Pass as seen in the gifs below for AC2 and AC3.

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS Sonoma 14.6.1
Browser: Chrome 127
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify the absence of dark mode styles in the deployed code

  1. Perform a search in the deployed codebase using the link: https://codesearch.wmcloud.org/deployed/?q=%40media+%5C%28+prefers-color-scheme%3A+dark.
  2. AC1: Confirm that the search yields no results, except potentially within the Flow extension.

Not sure if this is for beta, prod, or both

screenshot 3.png (734×1 px, 140 KB)

Test Case 2: Verify that print preview displays in light mode for multiple namespaces

  1. Enable dark mode in the user's settings.
  2. Navigate to the main page.
  3. Open the print preview for the page.
  4. AC2: The print preview should appear in light mode.

2024-08-27_11-37-55.mp4.gif (702×1 px, 1 MB)

  1. Repeat steps 2-4 for the article namespace, talk page, and special page.
  2. AC3: Verify that the print preview in each of these namespaces also appears in light mode, regardless of dark mode being enabled on the screen.
ArticleTalkSpecial
2024-08-27_11-41-34.mp4.gif (888×1 px, 2 MB)
2024-08-27_11-47-36.mp4.gif (552×1 px, 3 MB)
2024-08-27_11-49-55.mp4.gif (586×916 px, 1 MB)