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 created this task.Jun 10 2019, 2:29 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 10 2019, 2:29 PM
Izno updated the task description. (Show Details)Jun 10 2019, 2:31 PM
Tgr moved this task from Up next to External on the TemplateStyles board.Jun 10 2019, 5:49 PM
MJL added a subscriber: MJL.Jun 20 2019, 6:08 AM
Aklapper updated the task description. (Show Details)May 10 2020, 1:30 PM
Izno updated the task description. (Show Details)Jun 20 2020, 2:56 PM
Izno updated the task description. (Show Details)
Izno updated the task description. (Show Details)Jun 20 2020, 3:01 PM

@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!

Tgr added a comment.Oct 29 2020, 4:58 PM

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

Izno added a comment.EditedOct 29 2020, 5:53 PM

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.

Tgr added a comment.EditedOct 29 2020, 8:30 PM

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.

Tgr added a comment.Oct 29 2020, 8:32 PM

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!

Aklapper added a comment.EditedOct 31 2020, 10:19 AM

@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

Izno closed this task as Resolved.Nov 10 2020, 8:43 PM

Looks done to me!