Page MenuHomePhabricator

Color options in appearance menu should be disabled if gadget detected
Closed, ResolvedPublic3 Estimated Story Points

Description

NOTE: In the current state various users reported the site being unusable - these users were not aware they were using the gadget and didn't know how to disable it (or how to switch from automatic to light mode). In response to this, English Wikipedia was hot-fixed with https://en.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-dark-mode-toggle.js&diff=1224049699&oldid=1187865629 . It's recommended that you copy across this change to their own local version of the gadget until this is addressed until this task is fixed. Note, on enwiki this was later reverted 20th May which will likely lead to more support requests.

Background

The dark mode gadget is conflicting with the new desktop dark mode. We encountered a similar issue with page previews.

User story

As a user who is using the dark mode gadget and happy with my dark mode experience, it should be possible to continue to use the gadget without conflicts with Vector's dark mode.

Requirement

Ensure that the color options in the appearance menu are disabled if the dark mode gadget is detected.

BDD

Feature: Color Options Disabled with Dark Mode Gadget

  Scenario: Disable color options when dark mode gadget is detected
    Given the user has enabled the dark mode gadget
    When the user views the appearance menu
    Then the color options should be disabled
    And an exclusion notice should be shown
    And clicking "Disable the gadget" should disable the gadget and reload the page

Test Steps

Test Case 1: Disable Color Options When Dark Mode Gadget is Detected

  1. Go to Special:Preferences on the beta cluster and enable the dark mode gadget.
  2. Visit the Main Page.
  3. Open the appearance menu.
  4. AC1: Confirm that the color options are disabled.
  5. AC2: Confirm that an exclusion notice is shown.
  6. AC3: Confirm that clicking "Disable the gadget" disables the gadget and reloads the page, showing the enabled appearance menu.

Design

  • Add mockups and design requirements

Acceptance criteria

  • If I enable the gadget in Special:preferences for dark mode and turn it on, the dark mode toggle in the appearance menu should be disabled.
  • When we detect the gadget, we will remove the associated classes on the HTML to force day theme and we will make the color control disabled.
  • We will show an exclusion notice that reads ""You're using a dark mode gadget that interferes with this feature. Disable the gadget https://wikipedia.org to use dark mode."
  • When "Disable the gadget" is tapped, the gadget should be disabled and the page will reload showing the enabled appearance menu. This will require hitting the user preference API.
  • Since the gadget may be localized per wiki, we will need to use a message to obtain the gadget name. On English Wikipedia we can check this by calling mw.loader.getState('dark-mode-toggle') !== 'registered'. A localized version would look like mw.loader.getState(mw.msg('vector-gadget-darkmode-name')) !== 'registered'

QA beta cluster

Communication criteria - does this need an announcement or discussion?

No.

Rollback plan

No rollback should be necessary here. However after deployment we should check if any changes to https://en.m.wikipedia.org/wiki/MediaWiki:Gadget-dark-mode-toggle.js need to be made.

Sign off steps

  • Jon should rollback any unnecessary gadget changes.

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

QA Results - Beta

ACStatusDetails
1T365083#9851628
2T365083#9851628
3T365083#9851628

Event Timeline

Ugh. ~+100 users are importing https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-dark-mode.css&action=raw&ctype=text/css on frwiki. Two editors I came across who reported a catastrophic dark mode had CSS rules that conflicted. New job unlocked for interface administrators I guess.

Seems like we have three options:

  1. Disable dark mode (users must use gadget)
  2. Give them notice so they disable gadget (users must use dark mode)
  3. Have them choose (users can choose)

Let's scope out which of these are possible

We discussed this and identified two tasks. We will repurpose this task as task 1.

#Task 1

  • When we detect the gadget, we will remove the associated classes on the HTML to force day theme and we will make the color control disabled.
  • We will show a notice that reads "This has been disabled by the dark mode gadget. Disable the gadget to use this feature." When "Disable the gadget" is tapped, the gadget should be disabled and the page will reload showing the enabled colors.
  • @JScherer-WMF will provide copy for this notice.

Task 2

We also talked about the Minerva launch notification we are building in T361047. We will also want to do this for Vector skin. This seems like the right time to evolve this design to consider the gadget being enabled.

image.png (293×719 px, 52 KB)

Copy update:

"You're using a dark mode gadget that interferes with this feature. Disable the gadget to use dark mode."

  • Clicking the link disables the gadget and forces a page refresh.
  • When the page finishes loading, the gadget will be disabled and the dark mode feature in the appearance menu will be enabled.
Jdlrobson renamed this task from Dark mode should be disabled if gadget detected to Color options in appearance menu should be disabled if gadget detected.Thu, May 16, 8:41 PM
Jdlrobson triaged this task as High priority.
Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
  • When we detect the gadget, we will remove the associated classes on the HTML to force day theme and we will make the color control disabled.
  • We will show a notice that reads "This has been disabled by the dark mode gadget. Disable the gadget to use this feature." When "Disable the gadget" is tapped, the gadget should be disabled and the page will reload showing the enabled colors.

This looks okay to me.

@Jdlrobson, @JScherer-WMF

We also talked about the Minerva launch notification we are building in T361047. We will also want to do this for Vector skin. This seems like the right time to evolve this design to consider the gadget being enabled.

Just to clarify - does this mean we'll have a modal for vector22 in general announcing dark mode and a secondary one that appears only if we detect the gadget?

Change #1036766 had a related patch set uploaded (by Stoyofuku-wmf; author: Stoyofuku-wmf):

[mediawiki/skins/Vector@master] Disable night mode if gadget detected

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

This is ready for review with a few big caveats:

  • It's currently desktop-only - we're gonna spin off a separate ticket for mobile
  • I had to lower the test coverage threshold to be able to submit it without tests attached - I feel guilty about this and will be revisiting the tests, but didn't want that to hold up review if we need to get this out sooner than later
  • Currently the message is hardcoded to English - it wasn't clear to me whether this is intended, but if we want to keep the current format of the message (see attached), I would need to talk with someone about the best way to accomplish this while making it translatable given the call to action is in the middle of the message

image.png (350×460 px, 37 KB)

Moving back to doing following our chat in SHDT as my understanding is you are working on localization and testing. Lemme know if I've misunderstood next steps (your patch looks like it's got the right idea if you needed words of encouragement)!

This may slip into the next sprint (and that's okay!)
Patch should be read by afternoon today PST.

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

[mediawiki/skins/Vector@master] Minor code change to literal

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

Change #1036766 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Disable night mode if gadget detected

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

Change #1037642 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Minor code change to literal

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

Change #1037647 had a related patch set uploaded (by Stoyofuku-wmf; author: Stoyofuku-wmf):

[mediawiki/skins/Vector@master] Minor fixes to gadget disable logic

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

Change #1037647 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Minor fixes to gadget disable logic

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

Edtadros subscribed.

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: Disable Color Options When Dark Mode Gadget is Detected

  1. Go to Special:Preferences on the beta cluster and enable the dark mode gadget.
  2. Visit the Main Page.
  3. Open the appearance menu.
  4. AC1: Confirm that the color options are disabled.

screenshot 464.png (1×1 px, 256 KB)

  1. AC2: Confirm that an exclusion notice is shown.

See AC1.

  1. AC3: Confirm that clicking "Disable the gadget" disables the gadget and reloads the page, showing the enabled appearance menu.

screenshot 465.png (1×1 px, 266 KB)

Jdlrobson claimed this task.

The gadget changes already got rolled back so I am marking the sign off step as done. Work will need to be done localizing the message keys. I will prepare that by end of day.