Page MenuHomePhabricator

Enable templatestyles in Modern for "document" rules
Closed, ResolvedPublic

Description

There are a batch of rules in Modern main.css starting with #content a.external { and continuing to

#content a.external[ href$='.pdf' ],
#content a.external[ href$='.PDF' ],
#content a.external[ href*='.pdf#' ],
#content a.external[ href*='.PDF#' ],
#content a.external[ href*='.pdf?' ],
#content a.external[ href*='.PDF?' ],
.link-document {
	/* @embed */
	background: url( images/document.png ) center right no-repeat;
	padding-right: 12px;
}

which should probably reference .mw-parser-output instead of #content, so that TemplateStyles can reasonably override the default styling. All/the majority of the other skins had this change made. It should be backward compatible with wiki-defined values simply to swap #content 1:1 with .mw-parser-output, as the wiki-defined values will still be more specific.

Discussion arose in the context of Help talk:CS1.

Event Timeline

Izno updated the task description. (Show Details)

@Izno @Tgr @MJL Hi I was looking at this issue and I would like to work on it. I am new to mediawiki. I was looking at this file https://phabricator.wikimedia.org/diffusion/SMOD/browse/master/resources/main.css, do I have to change mentioned id selector #content to class selector .mw-parser-output? Please guide!

I'm not sure I understand this task. Why can't one override these styles with TemplateStyles as they are now?

I'm not sure I understand this task. Why can't one override these styles with TemplateStyles as they are now?

I cannot override #content because t styles cannot access it (I guess I could pick another ID inside mw-parser-output -- are there any?). I don't really want to though because all the other WMF deployed skins are targeting (correctly IMO) mw-parser-output. I'd have to duplicate the relevant selectors just because of one skin. The alternative is !important, which is categorically bad.

That makes sense, thanks; I didn't think about the different specificity. Note that .mw-parser-output is used in other places where the content comes from the parser. Probably that's a good thing, as the styles in question should apply there.

I was looking at this file https://phabricator.wikimedia.org/diffusion/SMOD/browse/master/resources/main.css, do I have to change mentioned id selector #content to class selector .mw-parser-output? Please guide!

Yeah, probably all uses of #content as an ancestor can be replaced.

Change 637785 had a related patch set uploaded (by Shubham656jain; owner: Shubham656jain):
[mediawiki/skins/Modern@master] Change #content ancestor selector to .mw-parser-output in main.css

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

@Tgr I have done the changes. Please review!

@Shubham656jain: Hi, please don't ping random people immediately for review, in addition to the Phabricator notification by Gerritbot, and in addition to a potential Gerrit mail notification. We already all get too many notifications in too many places - thanks!

Change 637785 merged by jenkins-bot:
[mediawiki/skins/Modern@master] Change #content ancestor selector to .mw-parser-output in main.css

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

Looks done to me!