Page MenuHomePhabricator

Dark Mode: Portal namespace color stripping is too aggressive
Open, MediumPublicBUG REPORT

Description

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

What happens?:
There is a transclusion of the Sitzverteilung template that got all the colors stripped and appears unreadable.

What should have happened instead?:
Template output and colors are readable

I see two major problems with the current color stripping introduced in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikimediaMessages/+/1070207 / T366380 / https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikimediaMessages/+/refs/heads/master/modules/ext.wikimediamessages.styles/theme-night-portal.less:

  • the .notheme exclusion is almost useless for nested elements with the current .ns-100 .mw-parser-output :not( .notheme ):not( a ) selector; this strips all colors from elements that have no .notheme class even if they are inside a .notheme parent.
    • something like .ns-100 .mw-parser-output :not( .notheme *, a ) would allow to exclude from color stripping with respect to nesting.
  • .notheme is treated ambiguously.
    • sometimes it means don't apply dark mode styles, like in the thumb frame that is generated by the Sitzverteilung template.
    • for the portal namespace color stripping, it means don't apply the special overrides.
    • these are two different cases which, when done with one class, result in a broken look e.g. if the transclusion of the Sitzverteilung template would be wrapped in .notheme and my proposed nesting adjustment is applied.
    • in the linked example, I want the dark mode styles, but I don't want the color stripping. This is not possible with the current implementation of .notheme.
    • IMO it is necessary to use a different class for the don't apply the special overrides case.

Event Timeline

Have you tried disabling the stylesheet using theme-night-portal and adding a more suitable stylesheet for portals on your project?:
https://www.mediawiki.org/wiki/Extension:WikimediaMessages#Disabling_styles

Jdlrobson changed the task status from Open to In Progress.Thu, Dec 5, 5:29 PM
Jdlrobson triaged this task as Medium priority.Thu, Dec 5, 6:09 PM

I actually did this already for other central stylesheets, but I thought this issue should affect also other projects and is therefore worth a central fix. As portal namespace has relatively low traffic and darkmode is not yet broadly available on dewiki, I don't see this as a high priority in our local context. But depending on the outcome here I will revisit.

Jdlrobson changed the task status from In Progress to Open.Fri, Dec 6, 4:53 PM
Jdlrobson added a project: patch-welcome.

I actually did this already for other central stylesheets, but I thought this issue should affect also other projects and is therefore worth a central fix. As portal namespace has relatively low traffic and darkmode is not yet broadly available on dewiki, I don't see this as a high priority in our local context. But depending on the outcome here I will revisit.

Got it! Thanks! Most portals are low traffic unfortunately. On English which is the one I'm most familiar with I'm not aware of the problem you describe here with color stripping, but I may be wrong, and I think overall it leads to the majority of pages get improved accessibility.

I do agree that notheme should work more reliably there. Wrapping the thumbnail on your example page with div.notheme should be enough to turn it off and clearly that doesn't work.