Steps to replicate the issue (include links if applicable):
- browse to german article for David Baldacci
- switch to dark mode if inactive
- observe the signature in the figure caption of the portrait image
What happens?:
- the signature background is dim white, despite the class skin-invert-image set for the signature image
What should have happened instead?:
- the signature image should display inverted, i. e. white on black in dark mode (the usual effect when setting skin-invert-image class)
Related source link
The lesscss code in https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/master/resources/src/mediawiki.skinning/content.media-dark.less does not deal well with nested figures/images. The compiled CSS rule figure[ typeof^='mw:File' ]:not( .skin-invert-image ) img currently corresponds to
- <figure><a><img /></a></figure> as well as
- <figure><a><img /></a><figcaption>lorem ipsum <figure><a><img /></a></figure></figcaption></figure>`
That is, the presence (or abscence) of class=skin-invert-image with respect to the first figure element 'wins' over the nested one. To fix this, the CSS selector in place needs to be more specific, for instance recode with child rather than descendant css selector.