Page MenuHomePhabricator

File pages are not compatible with night mode
Closed, ResolvedPublicBUG REPORT

Description

NOTE: This may need a fix for images with transparent background e.g. https://commons.wikimedia.org/wiki/File:Wiktionary-logo-en.svg

Steps to replicate the issue (include links if applicable):

What happens?:
Color contrast issues

What should have happened instead?:
Fixes are required in the following templates:

Fixes in core are required:

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

QA Results - PROD

ACStatusDetails
1T357575#10018697

Details

Related Changes in Gerrit:

Event Timeline

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

Some of this might be addressed by the task we are working on in T356899.
It would be a good idea if that doesn't address the issue to disable night mode on file pages (at least to start with)

Work for WMF:
Update the following hex codes to design tokens:

Work that @Mike_Peel can help us with:

table.commons-file-information-table, .fileinfotpl-type-information, .fileinfotpl-type-artwork,
.fileinfo-paramfield {
      color: #202122;
}

e.g. <div class="hproduct commons-file-information-table"> should become <div class="notheme hproduct commons-file-information-table">

@Mike_Peel add this code to your user JS to force night mode on file pages:

(function () {
   const c = document.documentElement.classList;
   if ( c.contains( 'skin-night-mode-page-disabled' ) ) {
     c.remove( 'skin-night-mode-page-disabled' );
     c.add( 'skin-theme-clientpref-night' );
     const btn = document.createElement('button');
     btn.textContent = 'restore day theme';
     btn.setAttribute('style', 'position: fixed; bottom: 0; right: 0;' );
     document.body.appendChild(btn);
     btn.addEventListener('click', () => {
          c.add( 'skin-night-mode-page-disabled' );
          c.remove( 'skin-theme-clientpref-night' );
     } );
   }
}());

Do we need design support on this to choose the right tokens, @Jdlrobson ?

Not yet. Right now I'm just waiting on @Mike_Peel 's availability! He said he might be able to have a look this week.

Work that @Mike_Peel can help us with:

table.commons-file-information-table, .fileinfotpl-type-information, .fileinfotpl-type-artwork,
.fileinfo-paramfield {
      color: #202122;
}

Edit made, although it doesn't seem to have changed anything? https://commons.wikimedia.org/w/index.php?title=MediaWiki:Filepage.css&diff=prev&oldid=879884269

@Mike_Peel add this code to your user JS to force night mode on file pages:

(function () {
   const c = document.documentElement.classList;
   if ( c.contains( 'skin-night-mode-page-disabled' ) ) {
     c.remove( 'skin-night-mode-page-disabled' );
     c.add( 'skin-theme-clientpref-night' );
     const btn = document.createElement('button');
     btn.textContent = 'restore day theme';
     btn.setAttribute('style', 'position: fixed; bottom: 0; right: 0;' );
     document.body.appendChild(btn);
     btn.addEventListener('click', () => {
          c.add( 'skin-night-mode-page-disabled' );
          c.remove( 'skin-theme-clientpref-night' );
     } );
   }
}());

I generally avoid using the mobile interface, I'm hoping dark mode might come to Vector 2022 at some point soon?

Not yet. Right now I'm just waiting on @Mike_Peel 's availability! He said he might be able to have a look this week.

I'm happy to help when I can, but please don't let me hold your work up!

Edit made, although it doesn't seem to have changed anything? https://commons.wikimedia.org/w/index.php?title=MediaWiki:Filepage.css&diff=prev&oldid=879884269

Seems to be working. Thanks!

The remaining issues seem to be with the links here in these red boxes which are not accessible:

Screenshot 2024-05-28 at 3.22.34 PM.png (435×604 px, 87 KB)

Screenshot 2024-05-28 at 3.24.07 PM.png (128×726 px, 40 KB)

Screenshot 2024-05-28 at 3.22.55 PM.png (431×760 px, 79 KB)

Could we make those use a different blue with a different color contrast or simply make these black with an underline? Would that be controversial?

I generally avoid using the mobile interface, I'm hoping dark mode might come to Vector 2022 at some point soon?

It's available on Vector 2022 now. You can copy this script into your global.js and it will work on both mobile and desktop on all pages:
https://meta.wikimedia.org/wiki/User:Jdlrobson/global.js

Could we make those use a different blue with a different color contrast or simply make these black with an underline?

I think black-with-underline would make it much less discoverable (maybe even for people who currently have difficulties reading it due to the contrast issues): underlining is often used to highlight important text (e.g. in the made-up example you must attribute the author), so people wouldn’t understand it as a link. Therefore I think the only good solution is playing with different shades of blue – the question is only which ones.

Screenshot 2024-05-28 at 3.22.34 PM.png (435×604 px, 87 KB)

Since the link color is the default one and the background color is custom, I’d rather change the background color in the template.

Screenshot 2024-05-28 at 3.24.07 PM.png (128×726 px, 40 KB)

Using Minerva, Firefox’s accessibility inspector says that the color contrast is 5.1 (AA compliant, not even borderline). Which skin/accessibility check tool do you use?

Screenshot 2024-05-28 at 3.22.55 PM.png (431×760 px, 79 KB)

This is the same as the first one, except that the background color is, while not default, a quasi-standard one, so I’m more reluctant changing it (this one would likely be controversial).

Jdlrobson raised the priority of this task from Medium to High.Jun 3 2024, 4:22 PM

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

[mediawiki/core@master] Disable non-standard colors in dark mode

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

Using Minerva, Firefox’s accessibility inspector says that the color contrast is 5.1 (AA compliant, not even borderline). Which skin/accessibility check tool do you use?

I'm using WCAG color contrast checker. Are you perhaps checking the :visited link color (which is AA compliant)?

Screenshot 2024-06-03 at 1.08.49 PM.png (410×556 px, 59 KB)

Screenshot 2024-06-03 at 1.09.15 PM.png (340×1 px, 192 KB)

Change #1038434 merged by jenkins-bot:

[mediawiki/core@master] Disable non-standard colors in dark mode

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

Jdlrobson changed the task status from Open to Stalled.Jun 4 2024, 5:12 PM

With the above patch merged, we've done everything we can for file pages for now. This is now stalled until OOUI supports dark mode to address the one remaining issue with structured data:
https://commons.wikimedia.org/wiki/File:At_Wikimedia_Hackathon_Athens_(MP)_2023_001_(cropped).jpg?vectordarkmode=1

Screenshot 2024-06-04 at 10.11.44 AM.png (72×379 px, 4 KB)

Using Minerva, Firefox’s accessibility inspector says that the color contrast is 5.1 (AA compliant, not even borderline). Which skin/accessibility check tool do you use?

I'm using WCAG color contrast checker. Are you perhaps checking the :visited link color (which is AA compliant)?

Screenshot 2024-06-03 at 1.08.49 PM.png (410×556 px, 59 KB)

Screenshot 2024-06-03 at 1.09.15 PM.png (340×1 px, 192 KB)

Your screenshots show the (Reusing this file) link; that’s highlighted as a violation by Firefox as well. What isn’t highlighted, is the link in the {{Extracted from}} template. As far as I remember, I tested it both in before and after clicking it. (Although what I do remember, is that toggling the :hover pseudo-class didn’t change the results, not even the colors displayed next to the contrast ratio… But evaluating the visited color before I’ve clicked the link would be another level of being buggy.)

What isn’t highlighted, is the link in the {{Extracted from}} template. As far as I remember, I

The links in extracted is working now after a template change: https://commons.wikimedia.org/w/index.php?title=Module:Information&diff=prev&oldid=881177359 - note this issue was only occurring in the night theme where the link colors are different (so I can see why that was a confusing comment I posted). Before that the color contrast was 3.03.

This ticket is ready for estimation on the understanding that some changes will still be required by editors after the deploy, and that the update to OOUI to support dark mode, needs to be deployed in production first (hence why this ticket is stalled).

note this issue was only occurring in the night theme where the link colors are different (so I can see why that was a confusing comment I posted).

I see. Your screenshot showed so little of the page that I didn’t notice it’s night mode (it has only a tiny black line on the right) – and the next screenshot is clearly day mode, adding to the confusion.

The links in extracted is working now after a template change: https://commons.wikimedia.org/w/index.php?title=Module:Information&diff=prev&oldid=881177359

Thanks, but I’m not sure if it’s the right place for this.

  • On the one hand, {{Extracted from}} can appear outside of the information, so it should definitely have notheme on its own and not rely on being embedded in any particular template (until it’s made actually night mode compatible). So far clear.
  • On the other hand, the content of the information template may (or may not) already be night mode compatible. If it is, unconditionally adding notheme to the embedding template worsens the situation. If it relies on a mix of CSS variables and skin-theme-clientpref-*-dependent custom styles, adding notheme worsens the situation a lot.
Jdlrobson changed the task status from Stalled to Open.Jun 12 2024, 8:46 PM
Jdlrobson updated the task description. (Show Details)

This looks good to ship from my perspective, with the caveat that many issues will still need to be fixed on wiki.

Jdlrobson lowered the priority of this task from High to Low.Jun 13 2024, 12:42 AM

Updating priority based on web team internal spreadsheet.

This may need a fix for images with transparent background e.g. https://en.wikipedia.org/wiki/Gas_flare

I don’t see any image with transparent background on that page. If you mean https://commons.wikimedia.org/wiki/File:FlareStack_System.png, it has an opaque gray background.

Likewise please let us know what date you want to deploy this!

ovasileva raised the priority of this task from Low to Medium.EditedJul 2 2024, 1:41 PM

We can do this one this week. Leaving in the sprint for now.

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS Sonoma 14.3
Browser: Chrome 126
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps
  1. https://en.wikipedia.org/w/index.php?title=File:At_Wikimedia_Hackathon_Athens_(MP)_2023_001_(cropped).jpg&vectornightmode=1

Appears in dark mode:

Screenshot 2024-07-26 at 9.19.26 AM.png (1×2 px, 2 MB)

Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: GMikesell-WMF.