Page MenuHomePhabricator

File pages are not compatible with night mode
Open, MediumPublicBUG REPORT

Description

NOTE: This work may be redundant if work in T356899 is successful.

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.):

Event Timeline

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).