Page MenuHomePhabricator

[3hr] [FRENCH WIKIPEDIA] Color Contrast Issue in Minerva Night Mode - .alternance
Closed, ResolvedPublic1 Estimated Story Points

Description

NOTE: This blocks deployment on French Wikipedia as it accounts for 4% of color contrast violations (Observed: March 8th 2024).

A common color contrast error has been identified in elements with the .alternance class using the night mode checker tool.

Details:
Regex Criteria: \.alternance
Location: Elements with .alternance class in French Wiki

Example:
https://fr.m.wikipedia.org/wiki/Cristiano_Ronaldo?minervanightmode=1&oldid=212987308&safemode=1#En_club

Success Criteria:
Find instances of this class and investigate the elements causing the color contrast issue in night mode.
Propose solution here to address if there isn't one already.

Event Timeline

Jdlrobson triaged this task as Medium priority.Feb 21 2024, 11:03 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson subscribed.

This only seems to impact French Wikipedia and doesn't seem fixable automatically. We'll need help from ambassadors for this one.

Jdlrobson renamed this task from Color Contrast Issue in Minerva Night Mode - .alternance to [FRENCH WIKIPEDIA] Color Contrast Issue in Minerva Night Mode - .alternance.Mar 9 2024, 1:05 AM
Jdlrobson updated the task description. (Show Details)

Hello,
"Alternance" refers to a class for tables that allows every other row to have a slightly different background color. This visual distinction helps to easily differentiate between the rows, similar to how every other comment has a different background color in the discussion pages of frwiki.

I tried this. Is it the kind of fix that is expected, or did I not understand the recommendations ?

@Escargot_rouge you understood them great! Thanks for also adding them to https://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Mobile.css ! Your changes seem to have addressed mostly addressed the issue we were seeing here!

Some things to consider:

  1. I think you may need another rule - I am still seeing some color contrast issues for the th element with "Sous-total" in the example.
  2. I don't think this applies here, but taking this approach in some cases you'll likely need to add rules for the links as well. The color of the dark mode link is slightly darker from light mode so what might be accessible in the standard mode may not be in dark mode.

Note: Ideally these should live in the template itself if possible - we know that a large MediaWiki:Common.css does impact SEO and site performance for slower devices (but that's a larger issue probably out of scope for this particular issue! :-))

ovasileva raised the priority of this task from Medium to High.Mar 21 2024, 8:09 AM

The remaining issues concerning the .alternance class are not caused by the class itself, but rather by inline colors applied to table cells in addition to the class.

Jdlrobson renamed this task from [FRENCH WIKIPEDIA] Color Contrast Issue in Minerva Night Mode - .alternance to [3hr] [FRENCH WIKIPEDIA] Color Contrast Issue in Minerva Night Mode - .alternance.Mar 21 2024, 5:32 PM
Jdlrobson set the point value for this task to 1.

Web team to provide guidance on remaining issues (e.g. links)

The following seems to work when dealing with the remaining .alternance related rules, while also addressing the inline colors in the table.

html.skin-theme-clientpref-night .mw-parser-output .fstats.alternance2 tr:nth-child(odd) th[scope="row"][colspan="3"] {
color: #333;
}

html.skin-theme-clientpref-night .mw-parser-output .fstats.alternance2 th[scope="row"][colspan="3"] {
color: #333;
}

html.skin-theme-clientpref-night .mw-parser-output .fstats.alternance2 tr:nth-child(odd) th[scope="row"][colspan="3"] ~ td {
    color: #333;
}

@Jdrewniak / @bwang Would appreciate a second look to confirm this makes sense.

{F44071685}

{F44071684}

Hey @KSarabia-WMF it looks like this addresses the text, but not the links.

I created https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=Alternance to show the issue with links. I think something like this could perhaps help with links:

html.skin-theme-clientpref-night .alternance [style] a {
    color: #333 !important;
    text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
  html.skin-theme-clientpref-os .alternance [style] a {
    color: #333;
    text-decoration: underline;
  }
}

Could you speak to Justin about links?

It looks like od1n has patched this somewhat already so I think as part of sign off once we are happy with the styles we should recommend these styles on the talk page:
https://fr.wikipedia.org/w/index.php?title=Mod%C3%A8le%3AFstats%2Fstyle.css&diff=213554115&oldid=213514042

Jdlrobson lowered the priority of this task from High to Medium.Apr 3 2024, 10:59 AM

Lowered priority as this only impacts French Wikipedia and we can't automatically fix it so the intention here is to provide guidance.

@Escargot_rouge Thank you so much for reaching out.

Please consider alternating the background colours of the table rows between @background-color/base #101418 and @background-color/subtle 202122. This way you don't have to invert half of the table content to match a different background. You can leave the content colour as #F8F9FA, and leave all of the link colours. You would still have a subtle variance between the rows to differentiate them. Here is a mock up showing the approach:

Screenshot 2024-04-03 at 3.19.08 PM.png (1×1 px, 419 KB)

Let me know what you think and if there are any other aspects of this I can help with!

Hello @JScherer-WMF , I'm not so familiar with how phabricator works.
How do we access the mock up?

I don't see a reason not to do this change, but is it safe already to use css variables on-wiki?

@Escargot_rouge Sorry about that. The image is updated. You can also see it here. CSS Variables should be safe to use when this ticket rolls out next week. The patch has been merged.