Wikipedia talk:TemplateStyles
This project page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
|
This page has archives. Sections older than 60 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
Template scripts
[edit]@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
[edit]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.
[edit]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.
Sitewide CSS, again
[edit]Six months after the aborted #RfC: converting sitewide CSS to TemplateStyles, I think it is time to revisit this. Would something like Should bots be permitted to make edits in support of migrating sitewide CSS to TemplateStyles?
be a helpful RFC question? I believe such a question would if successful unfreeze Wikipedia:Bots/Requests for approval/William Avery Bot 5 while also avoiding RfC after RfC on similar issues (if we need further bots). (And in hindsight I apologize for the terrible RfC question I asked six months ago; re-reading it I am wondering why I thought that would help. Live and learn.) HouseBlaster (talk · he/they) 23:48, 19 August 2024 (UTC)