Background
Due to complications arising from using two different storage mechanisms for some Vector 2022 features (user options for logged-in users and cookies via clientPreferences.js for anons) it was discovered that the night mode "exclude" feature does not work consistently for anonymous users. The "exclude" configuration, which should prevent some pages from appearing in dark mode, works for logged-in users, but not for anonymous user who have set a clientPreferences cookie via the Appearance menu.
Reproduction steps
- As an anonymous user, on https://en.wikipedia.beta.wmflabs.org/ ensure you have deleted the enwikimwclientpreferences cookie.
- Go to https://en.wikipedia.beta.wmflabs.org/wiki/Banana - the Appearance settings should be greyed out.
- Go to https://en.wikipedia.beta.wmflabs.org - change the appearanse menu settings to 'night mode'
- Go back to https://en.wikipedia.beta.wmflabs.org/wiki/Banana
expected
- The Appearance menu settings should continue to be greyed out after you set the client-preferences cookie.
observed
- The Appearance menu setting become available after setting the client-preferences cookie.
User story
- When switching between logged-in and logged-out, I expect the same pages to be excluded from night mode.
Requirements
- On pages that are excluded from night-mode via configuration (e.g. $wgVectorNightModeOptions['exclude']['mainpage'] = true) the night-mode settings in the Appearance menu should be greyed out for logged-in users, logged-out users, and when a logged-out or logged-in user changes the setting on a different page, then goes back to the excluded page, they should still be greyed out.
BDD
Feature: Night Mode Exclusion Logic
Scenario: Night mode settings greyed out for logged-in users on excluded pages
Given the user is logged into Wikipedia
And the user navigates to a page excluded from night mode
Then the night mode settings in the Appearance menu should be greyed out
Scenario: Night mode settings greyed out for logged-out users on excluded pages
Given the user is logged out of Wikipedia
And the user navigates to a page excluded from night mode
Then the night mode settings in the Appearance menu should be greyed out
Scenario: Night mode settings persist for logged-out users when returning to an excluded page
Given the user is logged out of Wikipedia
And the user changes the night mode setting on a non-excluded page
When the user returns to an excluded page
Then the night mode settings in the Appearance menu should still be greyed out
Scenario: Night mode settings persist for logged-in users when returning to an excluded page
Given the user is logged into Wikipedia
And the user changes the night mode setting on a non-excluded page
When the user returns to an excluded page
Then the night mode settings in the Appearance menu should still be greyed outTest Steps
Test Case 1: Night Mode Settings Greyed Out for Logged-In Users on Excluded Pages
- Open Wikipedia on the Vector 2022 skin and log in.
- Navigate to a page excluded from night mode.
- AC1: Confirm that the night mode settings in the Appearance menu are greyed out.
Test Case 2: Night Mode Settings Greyed Out for Logged-Out Users on Excluded Pages
- Open Wikipedia on the Vector 2022 skin and log out if logged in.
- Navigate to a page excluded from night mode.
- AC2: Confirm that the night mode settings in the Appearance menu are greyed out.
Test Case 3: Night Mode Settings Persist for Logged-Out Users When Returning to an Excluded Page
- Open Wikipedia on the Vector 2022 skin and log out if logged in.
- Change the night mode setting on a non-excluded page.
- Navigate back to a page excluded from night mode.
- AC3: Confirm that the night mode settings in the Appearance menu are still greyed out.
Test Case 4: Night Mode Settings Persist for Logged-In Users When Returning to an Excluded Page
- Open Wikipedia on the Vector 2022 skin and log in.
- Change the night mode setting on a non-excluded page.
- Navigate back to a page excluded from night mode.
- AC4: Confirm that the night mode settings in the Appearance menu are still greyed out.
Design
- Add mockups and design requirements
Acceptance criteria
- If I am an anonymous user, and I have selected night mode from the appearance menu in Vector, then I go to a page that should have night mode disabled, e.g. https://en.wikipedia.beta.wmflabs.org/wiki/Banana the night mode options should be disable in the appearance menu.
Communication criteria - does this need an announcement or discussion?
- N/A
QA Results - Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T364159#9798178 |
| 2 | ✅ | T364159#9798178 |
| 3 | ✅ | T364159#9798178 |
| 4 | ✅ | T364159#9798178 |
Task Description:
QA Results - PROD
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T364159#9807604 |
| 2 | ✅ | T364159#9807604 |
| 3 | ✅ | T364159#9807604 |
| 4 | ✅ | T364159#9807604 |






