Page MenuHomePhabricator

Dark mode for Wikimedia portals (e.g. www.wikipedia.org)
Closed, ResolvedPublic2 Estimated Story PointsFeature

Description

Background: Although Wikipedia's across most languages now have dark-mode, the www.wikipedia.org portal page does not.

User story: As someone using dark-mode on Wikipedia, I would expect that the wikipedia homepage should also work in dark-mode.

Requirements

  • The Wikimedia portal pages should appear in dark mode when system settings are set to "dark" mode.
  • The Wikimedia portals should import Codex as dependency
  • The Wikimedia portals should use Codex design tokens for the dark-mode color palette

Technical notes:

  • This scope of this task is to enable "auto" dark-mode on the Wikimedia portals (i.e. the colors should only change base on the prefers-color-scheme media query). Adding functionality for letting users choose the color mode explicitly is out of scope for this task.
  • The portals repo currently doesn't import Codex, so this dependency will have to be added via NPM.
  • This repo uses PostCSS instead of Less, so it should use the Codex package with native CSS variables instead of the Less variables.

Much of the CSS & HTML in the Wikimedia portals repo is shared between the www.wikipedia.org page and the sister project pages (e.g. www.wiktionary.org) so by introducing Codex and editing shared CSS, the sister project pages will be updated to support dark-mode as well.

BDD

Feature: Auto dark mode support for Wikimedia portals

  Scenario: Apply dark mode based on system preferences
    Given a user has their system set to dark mode
    When they visit a Wikimedia portal page
    Then the page should automatically display in dark mode

  Scenario: Default to light mode when system is not in dark mode
    Given a user has their system set to light mode
    When they visit a Wikimedia portal page
    Then the page should automatically display in light mode

Test Steps

Test Case 1: Verify dark mode applies automatically based on system settings

  1. Set your system display preferences to dark mode.
  2. Visit the following portals:

https://www.wikimedia.org
https://www.wikipedia.org
https://www.wiktionary.org
https://www.wikinews.org
https://www.wikiquote.org
https://www.wikivoyage.org
https://www.wikiversity.org
https://www.wikibooks.org

  1. Confirm that dark mode is automatically applied on all pages.
  2. AC1: Dark mode is applied based on system settings.

Test Case 2: Verify light mode applies when system is set to light mode

  1. Change your system display preferences to light mode.
  2. Visit the same portals listed in Test Case 1.
  3. Confirm that light mode is automatically applied on all pages.
  4. AC2: Light mode is applied when the system is set to light mode.

Design

The dark-mode color palette should use Codex design tokens.

Acceptance criteria

  • The wikipedia.org page appears in dark-mode when setting your system settings to "dark"
  • The remaining sister project sites, such as www.wiktionary.org, also appear in dark-mode.

Communication criteria - does this need an announcement or discussion?

N/A

Rollback plan

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

Revert & deploy the patches in question. Deploys can be done via backport window as this repo doesn't ride the regular deployment train.

QA Results - Prod

ACStatusDetails
1T368221#10542505
2T368221#10542505

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

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Duplicate of T366380.

nope that's a different task talking about the portal namespace, while this task asks for a dark mode on pages like www.wikipedia.org (the „entry“ pages before choosing a language version).

Diskdance renamed this task from Dark mode for Wikimedia portals to Dark mode for Wikimedia portals (e.g. www.wikipedia.org).Jun 23 2024, 3:08 PM
Jdlrobson subscribed.

Jan: Could you update this ticket to use the task template and move it to groomed? I assume this work entails updating the portal to use Codex design tokens and CSS variables? Is that accurate?

Jdrewniak updated the task description. (Show Details)
Jdrewniak moved this task from Incoming to Groomed on the Web-Team-Backlog-Archived board.

Change #1114339 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[wikimedia/portals@master] [WIP] wikimedia.org: Add dark mode support

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

Dark mode with the above patch.

grafik.png (1×3 px, 523 KB)

It's quite easy now.

Change #1114602 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[wikimedia/portals@master] wikipedia.org: Add dark mode

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

Change #1114602 merged by jenkins-bot:

[wikimedia/portals@master] wikipedia.org: Add dark mode

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

Thanks for the work on this @Ladsgroup , I'd deploy the change to www.wikipedia.org this week.

Jdlrobson-WMF changed the task status from Open to In Progress.Jan 28 2025, 4:55 PM
Jdlrobson-WMF moved this task from Freezer to Q3 on the Web-Team board.

I have a bit of free time now, I will try to work on dark mode in other projects too.

grafik.png (1×3 px, 353 KB)

grafik.png (1×3 px, 200 KB)

grafik.png (1×3 px, 330 KB)

grafik.png (1×3 px, 265 KB)

grafik.png (1×3 px, 304 KB)

disclaimer: I haven't managed to test the search yet and I'm not sure how to test it.

Change #1114817 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[wikimedia/portals@master] Add dark mode to the rest of projects

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

Change #1114339 merged by jenkins-bot:

[wikimedia/portals@master] wikimedia.org: Add dark mode support

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

Change #1115349 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[operations/mediawiki-config@master] Bump portal to HEAD

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

Change #1115349 merged by jenkins-bot:

[operations/mediawiki-config@master] Bump portal to HEAD

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

Mentioned in SAL (#wikimedia-operations) [2025-01-30T11:16:59Z] <ladsgroup@deploy2002> Synchronized portals/wikipedia.org/assets: Bump portals (T368221 and T373204) (duration: 02m 57s)

Only https://gerrit.wikimedia.org/r/1114817 needs merging and deploying and we can close this.

Random note, the button (.pure-button lives in _buttons.css) needs a refactor to make it use codex instead. It's similar to codex but I can see it's slightly different.

Search also works fine:

The border between search results looks like a light mode color to me.

Change #1115813 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[wikimedia/portals@master] common: Use codex tokens in search colors to improve dark mode

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

Search also works fine:

The border between search results looks like a light mode color to me.

I didn't even notice it. Fixed now.

Change #1115813 merged by jenkins-bot:

[wikimedia/portals@master] common: Use Codex tokens in search colors to improve dark mode

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

Jdlrobson-WMF set the point value for this task to 2.Jan 31 2025, 7:25 PM
Jdlrobson-WMF moved this task from Q3 to Sprint Backlog on the Web-Team board.
Jdlrobson-WMF lowered the priority of this task from Medium to Low.Feb 4 2025, 7:21 PM

If this patch is merged https://gerrit.wikimedia.org/r/c/1114817 I will deploy it ASAP. It's like the rest of projects and is quite straightforward.

Change #1114817 merged by jenkins-bot:

[wikimedia/portals@master] Add dark mode to the rest of projects

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

Mentioned in SAL (#wikimedia-operations) [2025-02-04T22:32:37Z] <ladsgroup@deploy2002> Synchronized portals/wikipedia.org/assets: Bump portals to HEAD (T368221 T373204) (duration: 09m 30s)

Jdlrobson-WMF reassigned this task from Ladsgroup to JScherer-WMF.

Reopening as we'd like to get @Edtadros to QA and get @JScherer-WMF to review.

Eyeballing it, the colours look good to me, but I'm unable to inspect the CSS variables in the screenshots.

The main issue with a dark mode on these pages is that users have no way to turn dark mode on/off without first visiting one of the sub-pages. I don't think that's a deal breaker though.

How does the user prefs logic work here? I go to EN Wiki, turn on dark mode, do I then get it on all portal pages, even WikiQuote, for example? Does the automatic switching work still if I choose automatic as my option?

If I already have dark mode enabled in my user prefs, do I automatically get dark mode on portal pages the next time I visit one?

@Edtadros We might need to go through these turning off/on use cases as part of QA.

Eyeballing it, the colours look good to me, but I'm unable to inspect the CSS variables in the screenshots.

The main issue with a dark mode on these pages is that users have no way to turn dark mode on/off without first visiting one of the sub-pages. I don't think that's a deal breaker though.

How does the user prefs logic work here? I go to EN Wiki, turn on dark mode, do I then get it on all portal pages, even WikiQuote, for example? Does the automatic switching work still if I choose automatic as my option?

If I already have dark mode enabled in my user prefs, do I automatically get dark mode on portal pages the next time I visit one?

@Edtadros We might need to go through these turning off/on use cases as part of QA.

Different color schemes here are automatically shown based on browser setting (and are independent from on-wiki settings). You can change the color preference (and switch to dark mode) by changing the browser to request the dark mode. Here is how it works in Firefox:

grafik.png (356×737 px, 34 KB)

The <select> dropdown seems not to be dark, reproduceable on Chrome and Firefox:

image.png (715×562 px, 36 KB)

It's in dark mode for me? I think this is browser's select and depends on how you set it. Eventually all of this should codex though but that's not related to this task.

Status: ✅ PASS
Environment: Various production portals
OS: macOS
Browser: Chrome
Device: MS

Test Case 1: Verify dark mode applies automatically based on system settings

  1. Set your system display preferences to dark mode.
  2. Visit the following portals:

https://www.wikimedia.org
https://www.wikipedia.org
https://www.wiktionary.org
https://www.wikinews.org
https://www.wikiquote.org
https://www.wikivoyage.org
https://www.wikiversity.org
https://www.wikibooks.org

  1. Confirm that dark mode is automatically applied on all pages.
  2. ✅ AC1: Dark mode is applied based on system settings.

Test Case 2: Verify light mode applies when system is set to light mode

  1. Change your system display preferences to light mode.
  2. Visit the same portals listed in Test Case 1.
  3. Confirm that light mode is automatically applied on all pages.
  4. ✅ AC2: Light mode is applied when the system is set to light mode.
ovasileva claimed this task.

The <select> dropdown seems not to be dark, reproduceable on Chrome and Firefox:

There is a CSS property https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme that should fix it but my tests didn’t confirm if setting it would fix the issue.