Page MenuHomePhabricator

Autocorrect content which uses inline styles using background without color
Closed, ResolvedPublic2 Estimated Story Points

Description

In T358240 we decided to use a CSS rule to make sure a color is always defined for templates. We deemed this would be less risky than a PHP based solution T358239 with no negative impact on performance.

The rule proposed would look like this and would only apply to night mode:

.mw-parser-output [style*="background"]{
   color: #333;
}

Steps to reproduce

Expected results

Example 1: Black text on yellow background.
Example 2: Purple text on yellow background.

Actual results

White text on yellow background.

Environments observed

  • Browser version:
  • OS version:
  • Device model:
  • Device language:

Check any additional observations

Developer checklist

  • Make sure the new rule only applies to automatic and day mode
  • The rule should not be !important, any inline styles which are defined should overwrite it
  • The rule should apply to background: yellow, background:yellow; and background-color: yellow
  • Make sure to include an ADR for this decision. Link to https://phabricator.wikimedia.org/T358240#9591458 in the decision record so outsiders understand why we did this.

Additional QA

The scope of this rule is pretty large so might cause some issues. We'll want to do lots of exploratory testing to understand this more.

In production

QA Results - Beta

ACStatusDetails
1T358797#9643947
2T358797#9643947

QA Results - Prod

ACStatusDetails
1T358797#9643981
2T358797#9643981

Event Timeline

Jdlrobson updated the task description. (Show Details)
Jdlrobson updated the task description. (Show Details)
Jdlrobson set the point value for this task to 2.

Change 1006872 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/MinervaNeue@master] [POC] Attribute selector contrast issue fix

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

I added an old POC:

in final patch it has to be don in the hacks.less and make sure to have the .mw-parser-output class as parent

Jdlrobson renamed this task from [placeholder] Autocorrect content which uses inline styles using background without color to Autocorrect content which uses inline styles using background without color.Mar 1 2024, 6:01 PM
Jdlrobson updated the task description. (Show Details)

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

[mediawiki/skins/MinervaNeue@master] Fix color for inline styles with background color in night mode

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

Change 1010330 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Fix color for inline styles with background color in night mode

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

Change 1006872 abandoned by Mabualruz:

[mediawiki/skins/MinervaNeue@master] [POC] Attribute selector contrast issue fix

Reason:

This was done in 1010330

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

Jdlrobson lowered the priority of this task from High to Medium.Mar 18 2024, 5:18 PM
Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/T35879?minervanightmode=1 or https://en.m.wikipedia.org/w/index.php?title=User:Jdlrobson/sandbox&oldid=1211134141&minervanightmode=1
Expected results
✅ AC1: Example 1: Black text on yellow background.
✅ AC2: Example 2: Purple text on yellow background.

screenshot 59.png (506×1 px, 73 KB)

Test Result - Prod

Status: ❓ Need more Info
Environment: enwiki
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/T35879?minervanightmode=1 or https://en.m.wikipedia.org/w/index.php?title=User:Jdlrobson/sandbox&oldid=1211134141&minervanightmode=1
Expected results
✅ AC1: Example 1: Black text on yellow background.
❓ AC2: Example 2: Purple text on yellow background.
@Jdlrobson, The pages with a ❓ below don't necessarily have a yellow background. Unclear if this is a pass or not.

screenshot 60.png (674×1 px, 96 KB)

✅ "Queen of the Ptolemaic Kingdom" in infobox on https://en.m.wikipedia.org/wiki/Cleopatra?minervanightmode=1

screenshot 61.png (674×1 px, 392 KB)

❓ "Screenshot" in infobox on https://en.m.wikipedia.org/wiki/Facebook?minervanightmode=1
There is no yellow background.

screenshot 62.png (674×1 px, 305 KB)

❓ Infobox on https://dag.m.wikipedia.org/wiki/Paris?minervanightmode=1
There is no yellow background.

screenshot 63.png (674×1 px, 297 KB)

❓ Infobox on https://da.m.wikipedia.org/wiki/Paris?minervanightmode=1
There is no yellow background.

screenshot 64.png (674×1 px, 344 KB)

@Edtadros sorry yellow background only applied to first example. In the other test cases we are looking for color contrast issues and checking there are none.

Test Result - Prod

Status: ❌ Fail
Environment: enwiki, dagwiki, dawiki
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/T35879?minervanightmode=1 or https://en.m.wikipedia.org/w/index.php?title=User:Jdlrobson/sandbox&oldid=1211134141&minervanightmode=1
Expected results
✅ AC1: Example 1: Black text on yellow background.
✅ AC2: Example 2: Purple text on yellow background.

screenshot 60.png (674×1 px, 96 KB)

❌ AC3: No color contrast issues on the elements below:

❌ "Queen of the Ptolemaic Kingdom" in infobox on https://en.m.wikipedia.org/wiki/Cleopatra?minervanightmode=1

screenshot 91.png (674×1 px, 320 KB)

✅ "Screenshot" in infobox on https://en.m.wikipedia.org/wiki/Facebook?minervanightmode=1

screenshot 92.png (674×1 px, 360 KB)

❌ Infobox on https://dag.m.wikipedia.org/wiki/Paris?minervanightmode=1
The text on the map is the only contrast issue in the infobox. I checked in day mode and the contrast issue is not there.

screenshot 93.png (674×1 px, 140 KB)

❌ Infobox on https://da.m.wikipedia.org/wiki/Paris?minervanightmode=1

screenshot 94.png (674×1 px, 435 KB)

Ooh interesting point - @Jdlrobson did we consider the link color adding contrast issues if we preserve the background color here? Or is the issue that we should be stripping it

❌ "Queen of the Ptolemaic Kingdom" in infobox on https://en.m.wikipedia.org/wiki/Cleopatra?minervanightmode=1

Fixed on wiki.

❌ Infobox on https://dag.m.wikipedia.org/wiki/Paris?minervanightmode=1
The text on the map is the only contrast issue in the infobox. I checked in day mode and the contrast issue is not there.

This can be a pass. The map is coming from the Kartographer extension and isn't essential for the article.

❌ Infobox on https://da.m.wikipedia.org/wiki/Paris?minervanightmode=1

I can no longer replicate this.. I think the infobox may have been vandalised?

❌ "Queen of the Ptolemaic Kingdom" in infobox on https://en.m.wikipedia.org/wiki/Cleopatra?minervanightmode=1

Fixed on wiki.

❌ Infobox on https://dag.m.wikipedia.org/wiki/Paris?minervanightmode=1
The text on the map is the only contrast issue in the infobox. I checked in day mode and the contrast issue is not there.

This can be a pass. The map is coming from the Kartographer extension and isn't essential for the article.

❌ Infobox on https://da.m.wikipedia.org/wiki/Paris?minervanightmode=1

I can no longer replicate this.. I think the infobox may have been vandalised?

Ok, this looks good. Resolving.

This can be a pass. The map is coming from the Kartographer extension and isn't essential for the article.

Just a note this is now fixed as part of T359082.

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

[mediawiki/extensions/WikimediaMessages@master] Use color-base instead of #333

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

Change #1023927 merged by jenkins-bot:

[mediawiki/extensions/WikimediaMessages@master] Use color-base instead of #333

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