![]() | Templates | |||
|
This page has archives. Sections older than 60 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
Duplicate styles
This question relates to a RfC at Wikipedia talk:Manual of Style/Tables#Template:Sort under and a discussion at the {{Sort under}} template talk page. One user expressed an interest in having two classes with identical styling for reasons he feels makes the template easier to use. Example:
- sort-under-center
- sort-under-right
- sort-under ["popular choice" with identical styles to sort-under-right]
It's my understanding that only essential styles are added to MediaWiki:Common.css to help keep size and load times minimal, amongst other reasons. Do template styles follow the same practice? Are there any unforeseen problems? Keep in mind that duplicating the styles would add an extra 16 CSS selectors (thus far) to Template:Sort under/styles.css. Jroberson108 (talk) 09:31, 5 February 2024 (UTC)
- The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section. A summary of the conclusions reached follows.
- Please observe WP:TALKFORK. --Redrose64 🌹 (talk) 12:15, 6 February 2024 (UTC)
- Common.css is a huge file. One of the reasons for TemplateStyles was to lessen the size of Common.css. So the CSS for TemplateStyles would only be pulled as needed.
- Some additional text for one more class in TemplateStyles is a very small addition. And it is very simple to do. But it greatly increases the ease of use of that template in my opinion. I edit a lot of tables. In fact, I have written large parts of Help:Table and its subpages. People copy what they see done on other tables. So they can copy it without having to wade through template docs, and make class choices.
- So far, there seems to be consensus for the first 2 classes. 2 editors want class=sort-under in addition. Jroberson108 is opposed.
- class=sort-under-center
- class=sort-under-right
- class=sort-under - with it being the popular choice so far: right.
- I want to use class=sort-under because it is easiest to remember. If I remember the template name, then I just add a dash and I then have the class name. That is how most of the table templates I use work:
{{static row numbers}}{{sticky header}}{{sort under}} {| class="wikitable sortable static-row-numbers sticky-header sort-under"
- And it is easier for less experienced table editors than me. The pattern is obvious. They can just copy the above 2 lines to many other sortable tables without problems. --Timeshifter (talk) 10:03, 5 February 2024 (UTC)
- @Timeshifter: WOW, there is no reason to duplicate the RfC here. I kept the question as concise and unbiased as I possibly could for a quick answer to verify the practice is acceptable before returning to RfC. They are capable of clicking on a link to read more. Jroberson108 (talk) 10:16, 5 February 2024 (UTC)
- I didn't think your post was clear or specific enough. And the other discussion is focused on multiple questions, not just this one. --Timeshifter (talk) 10:20, 5 February 2024 (UTC)
- @Timeshifter: WOW, there is no reason to duplicate the RfC here. I kept the question as concise and unbiased as I possibly could for a quick answer to verify the practice is acceptable before returning to RfC. They are capable of clicking on a link to read more. Jroberson108 (talk) 10:16, 5 February 2024 (UTC)
Template scripts
@Redrose64, TheDJ, and Pppery: or anyone else. I'm not seeing much documentation on template scripts, so I'm asking here. Can a script be added to the {{sticky header}} template for .sticky-header:not(.sortable)
to move header rows into the <thead>
element? I understand the need to avoid malicious code, but if it were managed similar to gadgets by someone with higher permissions, then I would think it's possible. Ideally, MediaWiki would just do this to all tables (not just sortable) making this script and the same move done in the sticky gadget obsolete. Jroberson108 (talk) 21:21, 16 February 2024 (UTC)
- This is not possible right now, but it may be possible soon with Wikipedia:On-demand gadgets. * Pppery * it has begun... 22:08, 16 February 2024 (UTC)
- @Pppery: Thanks for the quick response. Seems like it would work once available. The "no-JS fallback" for {{sticky header}} would simply be nothing sticky, similar to sortable tables not being sortable. {{Static row numbers}} would also benefit from the same move, but its "no-JS" version would be problematic. MediaWiki moving the rows without JS would be the best solution. Jroberson108 (talk) 23:04, 16 February 2024 (UTC)
RfC: converting sitewide CSS to TemplateStyles
Should TemplateStyles be officially preferred (where possible) to sitewide CSS for non-sitewide styling? 15:30, 21 February 2024 (UTC)
- Support as proposer, for all the reasons outlined in MediaWiki talk:Common.css/to do#Description of work. In particular, it allows more people to edit "sitewide" CSS (WP:5P3) and allows for faster load times. If successful, this would greenlight this stalled bot request and other related work. HouseBlaster (talk · he/him) 15:30, 21 February 2024 (UTC)
- I don't see how this RFC would do anything to un-stall that BRFA. The questions there are far more specific than "is TemplateStyles good?". Anomie⚔ 17:27, 21 February 2024 (UTC)
- My read of the discussion is that it was stalled (well, besides the fact that the bot operator went inactive) because it was
the first time a bot is "implementing" TemplateStyles this way places this BRFA as a precedent and puts an even larger onus on BAG to establish a clear consensus for the task
. I think this discussion would clearly resolve that concern. HouseBlaster (talk · he/him) 17:42, 21 February 2024 (UTC)
- I agree with Anomie here, the issue is more specific. This particular issue is: there are 100k pages using a class in a table "ad hoc" and we don't have anything currently in TemplateStyles that does similar on that many pages, and there's been at least some discussion prior that we could have issues down the road (which I think are negligible - the fix would be "re-add the CSS to Common.css"). There is clear consensus that moving stuff from global CSS to TemplateStyles is beneficial, otherwise the quantity of CSS already removed from MediaWiki:Common.css would be in violation of that implicit but otherwise clear consensus.
- Suggest removing the RFC tag for now and just getting all the types of editors on this page discussing the actual problem. Izno (talk) 17:47, 21 February 2024 (UTC)
- Happy to remove the RfC tag. HouseBlaster (talk · he/him) 18:13, 21 February 2024 (UTC)
- My read of the discussion is that it was stalled (well, besides the fact that the bot operator went inactive) because it was
- I don't see how this RFC would do anything to un-stall that BRFA. The questions there are far more specific than "is TemplateStyles good?". Anomie⚔ 17:27, 21 February 2024 (UTC)
- I'm not buying the argument that the community can't get edits made. First, any of these pages that are massively used are going to end up admin-protected anyway - and most admins aren't going to try to touch a SCSS page. Also, Category:Wikipedia interface-protected edit requests is rarely backlogged. — xaosflux Talk 15:47, 21 February 2024 (UTC)
- FWIW there's been a rather consistent trend of moving common->ts already @Izno: has been a key champion of this trend. Not sure there really is a problem to solve right now? For example, there is pretty much no chance we'd add any new template specific styling to sitewide scripts these days. — xaosflux Talk 18:18, 21 February 2024 (UTC)
- @Xaosflux Indeed. Take a look at what the BRFA linked by House wanted to do and then feel free to give an opinion on that. Izno (talk) 18:42, 21 February 2024 (UTC)
- FWIW there's been a rather consistent trend of moving common->ts already @Izno: has been a key champion of this trend. Not sure there really is a problem to solve right now? For example, there is pretty much no chance we'd add any new template specific styling to sitewide scripts these days. — xaosflux Talk 18:18, 21 February 2024 (UTC)
- (Summoned by bot) @HouseBlaster: For clarification, would
officially preferred
mean that - where possible - style rules in sitewide CSS should be moved to the TemplateStyles of the relevant templates? Only asking as it occurred to me that it could potentially also refer to changing the content model of all sitewide CSS files to TemplateStyles/moving all sitewide CSS rules to a fully-protected TemplateStyles page. (It might just be me who's confusing themselves with the wording, though!) All the best, —a smart kitten[meow] 17:18, 21 February 2024 (UTC)- @A smart kitten: it is meant to mean something like "when things are meant to display on every page, they should be in the sitewide style. If it is not something for the entire site and can feasibly be done by a template/with TemplateStyles, it should." I have amended the question for clarity (by adding the words
for non-sitewide styling
). HouseBlaster (talk · he/him) 17:27, 21 February 2024 (UTC)
- @A smart kitten: it is meant to mean something like "when things are meant to display on every page, they should be in the sitewide style. If it is not something for the entire site and can feasibly be done by a template/with TemplateStyles, it should." I have amended the question for clarity (by adding the words
- The question is too broad. Generally, TemplateStyles should be preferred; however, the developers have documentated certain cases where TemplateStyles current functionality should not be relied upon.
Styles included by a template can currently affect content on the page outside of the content generated by that template, but this ability may be removed in the future and should not be relied upon.
We should not make use of such functionality so as to not end up in a position where another migration would be needed if said functionality is removed, which would prohibit uses like the one proposed in Wikipedia:Bots/Requests for approval/William Avery Bot 5. — JJMC89 (T·C) 04:36, 22 February 2024 (UTC)- Yes, and as I've said already, I think both 1) their warning is bunkum (a different WMF engineer said this use is kosher!), and 2) the fix on our part is trivial (in two different ways, the first is putting templatestyles tags directly in article wikitext and the second is just putting the CSS back in Common.css if it's necessary), and 3) we already have other templates (like the one literally 2 sections above) doing the exact same thing. Izno (talk) 05:24, 22 February 2024 (UTC)
Urgent: Please fix this template for printed content Template:TemplateStyles sandbox/Sohom/altstyles.css.
![](https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Purple_arrow_down.svg/20px-Purple_arrow_down.svg.png)
Firstly, apologies for writing in English if this is not your first language (this is an automated message).
This template has been detected as one of 436 pages using styles that break the page when printed when the user is using dark mode. The fix is very straightforward - all your styles relating to dark mode must be scoped to. Since there is a high risk of this templates being copied to other wikis it is important this notice is acted on ASAP.
To fix this:
- Update `@media (prefers-color-scheme: dark` to `@media screen and (prefers-color-scheme: dark`
- Wrap any styles relating to `html.skin-theme-clientpref-night` in `@media screen`
If this message has not been acted on in 7 days, this will be fixed by an automated script. Thank you for your help fixing this important issue.
Jon (WMF) (talk) 17:54, 2 August 2024 (UTC) on behalf of the web team.