Module talk:Sidebar/Archive 5

Latest comment: 3 years ago by Izno in topic Difference in appearance
Archive 1Archive 3Archive 4Archive 5Archive 6

Stripped-tag errors #2

As I told before the Sidebar module produces a lot of linter errors. That's why I am proposing the following changes:

Change line 99 from

				:wikitext('</th></tr>') -- @todo replace this with unclosed again once mw.html gets it

to

				:wikitext('</td></tr><tr><td>') -- @todo replace this with unclosed again once mw.html gets it

and change line 165

					:tag('th')

to

					:tag('td') -- instead of th
						:css('font-weight', 'bold')

as we did it on the German Wikivoyage.

The main problem was the insertion of child sidebars both to table cells td (content) and table header cells th (heading). In line 99 we cannot know if the plain title text is added to td or th. That's why a lot of linter errors occur. --RolandUnger (talk) 16:15, 22 November 2017 (UTC)

RolandUnger, two things: (1) can you provide a link to an example which is generating these linter errors (one from an article is better than a manufactured example)? and (2) can you put your changes in the Module:Sidebar/sandbox? for Module:Infobox, we made this change to have the parent fix the children, since (as you note) it's not possible for the child to detect if the child is being embedded in a th or td cell. assuming that the parent cell is a td (and not a th) is probably the most likely case, but it's not clear to me that is always the case. Frietjes (talk) 17:48, 22 November 2017 (UTC)
I'm puzzled by the change from th to td, since I don't see an obvious need for that. These are properly th's in the vast majority of cases. --Izno (talk) 17:54, 22 November 2017 (UTC)
After changing line 165 you can remove line 99. You can see this change both on German Wikivoyage as on English Wikipedia. The main problem is caused by line 99, and programmers like Mr. Stradivarius should know this problem.
To 1st: It is really difficult to present an example because of 1.7 million "Missing end tag" and 0.6 million "Stripped tags" and the missing opportunity to filter theses errors.
But I will try to explain the problem: child sidebars were put into a (1) table cell td or a (2) table header cell th. The following code will be produced:
(1) <td> a title </th></tr> ... nothing else </td></tr>
/th has to be ignored because not opened, /td is missing because of closing /tr; /td and /tr have to be ignored because not opened
(2) <th> a title </th></tr> ... nothing else </th></tr>
Final /th and /tr have to be ignored because not opened
After these changes we do not have any linter errors caused by Sidebar at German Wikivoyage any longer. Please have a look to a working sidebar on voy:de:Template:Sidebar.
To 2nd: I put it to the sandbox.
Additionally, I like to propose the rewriting of the module. First: all sidebars should have table containers, not only the parent one. Then you can neglect the child parameter. The correct drawing can be made with CSS which can be moved to Common.css. Second: you should replace the tables by div tags. With both ideas you can simplify the code. --RolandUnger (talk) 06:18, 23 November 2017 (UTC)
RolandUnger, (1) I added Category:Pages using sidebar with the child parameter so we can find all the uses and make sure nothing is broken by any changes, (2) many of the subsidebars are using {{subsidebar bodystyle}} to change the outer inline css, (3) a rewrite to use div tags instead of tables was attempted on 3 June 2017‎, but there were so many problems that it had to be rolled back. basically, you have to have a method for finding/tracking all the places that implicitly assume that sidebar is generating table markup. it's possible to do the conversion and fix all the problems, but you need a method to find/fix all the problems. for example, what was done at Module:Navbox when we added the automatic striping. I agree that having the sitewide css detect that it's a child and style it appropriately would be great, but we would need a method for finding/fixing all the problems. Frietjes (talk) 14:42, 24 November 2017 (UTC)
it's been several weeks now and the lack of any substantial entries in Category:Pages using sidebar with the child parameter seems to indicate that most templates are using {{subsidebar bodystyle}} instead. assuming nothing changes over the next week or so, we can probably safely change the |child=yes feature to replicate the functionality of {{subsidebar bodystyle}} which will solve any potential problems. Frietjes (talk) 22:00, 14 December 2017 (UTC)
now updated. let me know if there are any problems. Frietjes (talk) 17:39, 19 December 2017 (UTC)

TemplateStyles in meta templates

Followers of this page may be interested in WT:TemplateStyles#In the context of meta templates. Please take a moment to comment there. --Izno (talk) 01:41, 27 July 2018 (UTC)

Collapsibility

The documentation says that

{{Sidebar with collapsible lists}} is a version of {{Sidebar}} that adds collapsibility to its sections, i.e. the means to show or hide sections by clicking links beside their headings.

Is Template:Sidebar collapsible or noncollapsible, or are only its sections noncollapsible? Hyacinth (talk) 06:55, 29 August 2018 (UTC)

Hyacinth, it is possible to make an entire {{sidebar}} collapsible by adding the classes to the sidebar. with the mw-collapsible class, the show/hide is added to the first available location. I recommend using a combination of font-size and resize to make sure that the show/hide links aren't really big when they are put in the outertitle or title location. Frietjes (talk) 14:57, 29 August 2018 (UTC)

Template:Calculation results

Currently {{Calculation results}} uses table code rather than {{Sidebar}} because the content of each heading uses two columns (one from beginning to the equal sign, and one for what follows the equal sign) and to allow the equal signs to align vertically. The template is tagged: "This template should be converted to a standardized format using Template:Sidebar." Are columns possible in a Sidebar content section / is colspan variable in sidebar content headings? If not, the tag should be removed and a comment should be added to the documentation (and a hidden comment should probably be added at the top). Hyacinth (talk) 01:38, 19 November 2018 (UTC)

Hyacinth, the typical method for adding columns is to embed an infobox or embed {{aligned table}}. Frietjes (talk) 17:04, 19 November 2018 (UTC)
Perhaps columns should be mentioned in the documentation for this module. Hyacinth (talk) 04:29, 20 November 2018 (UTC)

Standardisation?

In the archives, some seem to have suggested that sidebar templates ought merely mirror the contents of Template:Navboxes. Thumperward even experimented with a Template:Navbox vertical. While I doubt arguments going that far as to have sidebars exactly mirroring contents of navobxes would be convincing, at least some increased level of standardisation of the looks (rendering) of sidebars could probably be in the interest of the readers of Wikipedia? You could argue that the precurrent variation of looks of sidebars doesn't really serve any real purpose when a WP:CONSENSUS more standardsed looks for sidebars - still suitable for diverse applications over the board - could be achieved? Chicbyaccident (talk) 16:06, 29 November 2018 (UTC)

Chicbyaccident, {{Military navigation}} uses Module:Navbox to generate sidebars or footer navboxes depending the use of |style=wide. Frietjes (talk) 19:58, 29 November 2018 (UTC)

Images

I've noticed that sidebars still use hardcoded images (i.e. [[File:Placeholder.png|20px|caption]]). Is there a specific reason that a module hasn't been implemented similar to Module:InfoboxImage? Happy to work on that myself, just curious if it is simply a matter of no one having done it yet or if it was a conscious choice to intentionally NOT do that. --Zackmann (Talk to me/What I been doing) 19:01, 30 November 2018 (UTC)

We don't want to provide users the option to add their own images in sidebars generally in an instantiation of that sidebar in an article, so a module is overkill. --Izno (talk) 19:33, 30 November 2018 (UTC)
OH duh, this is only called from the template while an infobox is providing the image from the article. DUHHH. Thanks! --Zackmann (Talk to me/What I been doing) 20:14, 30 November 2018 (UTC)

Top margin

Could you please add a top margin (0.5 em) just like Infobox does, so the sidebar and message boxes won't touch (see Politics of Equatorial Guinea)? Thanks. --CaiusSPQR (talk) 00:45, 30 November 2019 (UTC)

Hardcoded element-level background color

This template currently hardcodes a css background color into the style attribute on the table tag with the following line: :css('background', '#f9f9f9'), which breaks the ability to style it with user CSS (eg Vector), because the style attribute is the most-specific possible identifier and not overrideable. This means you get color clashes when using eg a dark mode theme. There's no need to do this, as you could just use the class="infobox" to get the same styling as infoboxes have, which is obviously the desire, here. As a darkmode Vector user, I'd appreciate it if someone with the ability to fix this could so. Tossrock (talk) 07:48, 13 December 2019 (UTC)

Tossrock, I tried this but it broken the alignment. There is more in the infobox class than just the background. However, it does look like the fmbox-system class in MediaWiki:Common.css has just the background. But, it would be really non-intuitive to use that. It would be nice if we had a sidebar class like we have for infobox. Perhaps you can propose this on the talk page for MediaWiki:Common.css? Thanks! Plastikspork ―Œ(talk) 17:49, 26 April 2020 (UTC)

Spacing issue

Hi there, I'm having difficulty fixing a spacing problem. I recently put up Template:Archival records as a sidebar template with an infobox subbox embed. The template works, but it always inserts two line breaks between the top of the template and any text that follows. I haven't been able to put a finger on where the issue comes from. Example of template use here: Ursula Franklin. Scroll to ==External links==. Utl jung (talk) 19:06, 1 April 2020 (UTC)

Utl jung, it should be fixed now. Thanks! Plastikspork ―Œ(talk) 17:39, 26 April 2020 (UTC)
Fantastic. Very much appreciated, thank you Plastikspork! Utl jung (talk) 13:00, 27 April 2020 (UTC)

Template-protected edit request on 28 April 2020

Both TfD discussions are now completed, so Template:Sidebar's TfD notices should be removed. Thanks, Mdaniels5757 (talk) 20:12, 28 April 2020 (UTC)

To editor Mdaniels5757:   done. P.I. Ellsworth  ed. put'r there 22:28, 28 April 2020 (UTC)

Background color tweak request

Please change #f9f9f9 to #f8f9fa for sidebars to match infoboxes. —Born2bgratis (talk) 17:41, 3 June 2020 (UTC)

To editor Born2bgratis: not a big change, so   done. P.I. Ellsworth  ed. put'r there 20:16, 3 June 2020 (UTC)

Use mw-collapsible instead

Page watchers may be interested in Template talk:Sidebar with collapsible lists#Use mw-collapsible instead. --Izno (talk) 18:50, 30 June 2020 (UTC)

Margins above sidebars

I've noticed that sidebars (unlike infoboxes and images, among other article elements) lack a margin above them. This is especially noticeable when there is an ambox above, creating an unappealing result (see Special:PermanentLink/1002416203 for an example).

Could a similarly-sized margin be added to make sidebars consistent? — Goszei (talk) 10:08, 24 January 2021 (UTC)

I can add that to the TempateStyles changes coming. --Izno (talk) 17:32, 24 January 2021 (UTC)

TemplateStyles

I have been working on the sandbox, primarily for TemplateStyles and wanted to give a talk page section for heads-up/MY TEMPLATE BROKE. Full list of changes:

  1. Moved the styles to Module:Sidebar/styles.css and added classes where necessary for this.
  2. Moved the strings that could reasonably be internationalized to Module:Sidebar/configuration.
  3. Removed the "tnavbar*" parameters. There are none now out in the wild.
  4. Added an allowance for a |child templatestyles1= parameter. This would allow for downstream sidebars to define their own styles via a TemplateStyles page rather than in the masses of parameter code. I have added some output classes as a result that were not directly necessary for the main TemplateStylization. I imagine a limited series of these (possibly 2 and 3) in the event that there are multiple child templates (i.e grandchild sidebar uses child sidebar uses Sidebar).
  5. Converted from NavFrame to mw-collapsible! (!!! :)
  6. A slightly subtle change: I've changed the primary class from vertical-navbox to sidebar and accordingly added nomobile class to continue hiding the template from the mobile domain.

A few things I'd still like to do:

  1. Style the sidebar reasonably for < 720px resolution (basically, go to 100% width).
  2. Convert the tables to more-proper divs.
  3. Add a tracking category for modules/templates using styles parameters, for conversion to TemplateStyles and removal of the styles parameters.

Other miscellany:

  • Convert any user CSS to target .sidebar instead of .vertical-navbox, after merging live.

I would appreciate any feedback on the above, especially #2 in the "to do" list and the CSS for #5 in the changes list. I can think of no reason that this template (unlike infobox particularly) would need to work around any bizarre hacks like infobox 2-column row or whatever that is regarding use of a div rather than a table, so that's why I'm thinking to do that next. --Izno (talk) 01:01, 2 January 2021 (UTC)

I have added some output classes as a result that were not directly necessary for the main TemplateStylization. Yeah, probably just need to let the user define their own class for a row? --Izno (talk) 00:50, 3 January 2021 (UTC)

I've deployed this. Some followup:

  1. Migrate vertical-navbox to sidebar
    1. Javascript
    2. CSS
    3. Wikitext
    4. Lua? Just Module:Sidebar games events.
  2. Documentation (especially the new tracking category and templatestyles Stuff).
  3. Sort out nomobile for both Minerva and Timeless. See User talk:Jon (WMF)#nomobile is my current annoyance today. (Maybe Minerva followups?)
  4. Remove vertical-navbox and friends from module

If there are other questions please leave a note here. If there are buggy display, please detail it here and let me know on my talk page. --Izno (talk) 19:45, 25 January 2021 (UTC)

Done, perhaps aside from User talk:Jon (WMF)#nomobile is my current annoyance today and possibly some Minerva followups here and at MediaWiki:print.css. wheee --Izno (talk) 23:31, 15 February 2021 (UTC)

Make tables into divs instead

Took care of the stricken stuff. Still would like to convert the tables to divs. I saw a topic in the history that indicates there were issues the last time. Frietjes/Matt Fitzpatrick, are those issues still existent? --Izno (talk) 01:41, 6 January 2021 (UTC)
as far as I know, the table -> div conversion issues still exist. there are many uses that assume that this content container is a table (e.g. embedding an infobox), but if we could find a way to systematically find those and fix them, I would be all for such a conversion. Frietjes (talk) 19:43, 6 January 2021 (UTC)
Yeah, the history wasn't in this talk page so that's why I asked the question. More below because I like having lots of space to write questions. --Izno (talk) 19:49, 7 January 2021 (UTC)

Just to pull the list of problem children out of the history at User talk:Matt Fitzpatrick#Template:Politics of Panama, Template:Politics sidebar title and Template:Region history sidebar title assume a table structure, and long titles apparently had an issue e.g. at Template:Sex differences. So that looks like a yes. I wonder if such sidebar title templates are consistently named? --Izno (talk) 01:46, 6 January 2021 (UTC)

Some thoughts:

  1. Our categorization for sidebars looks like it sucks. Sidebars are probably being mixed in with navboxes. There's also no distinguishing for 'meta' or 'style' templates like Template:Politics sidebar title into their own category. So that will maybe be a project for the templates like that one. Maybe we can hit most of those just searching documentation pages for the word sidebar? Intitle search for sidebar?
  2. A separate 'project' to find direct uses of sidebar templates which have raw table markup in them. I think maybe we can do a raw text string for <th/td/tr> in the major content holding parameters? Or are searches like this one going to work for us?
  3. I'm not sure what you mean by embedding an infobox? Do you have an example in mind? I cannot see why that would be an issue since I was under the impression that infoboxes create well-formed HTML (not that I've looked), so they shouldn't be an issue generally.
  4. I think regardless of that work, we're going to find at least some template somewhere that's a mess that we miss and can deal with those as they come up.

Given that the sandbox is ready now for TemplateStyles, I think I'll merge what's there and leave a strong warning for new sidebar creators not to rely on the table structure, whether creating new ones or for the new TStyles conversion category. --Izno (talk) 19:49, 7 January 2021 (UTC)

In the past, if you tried to embed a table inside of a div container, and the div container was not large enough, you could get the table spilling outside of the div container. hence, if sidebar uses divs and infobox uses tables, then you can have problems with embedding tables inside of sidebars. some examples of infobox embedding include Template:Hindu philosophy. but, maybe things have changed if you use the "correct" display style for the div. Frietjes (talk) 23:29, 13 January 2021 (UTC)
Ah, ok, yes, I've seen that behavior. Timeless accounts well for it now and I think Minerva has done okay (because both have general support for "big tables").
That said, I still can't think of a template where infobox is embedded in a sidebar. That has sidebars embedded in a sidebar (which is certainly supported). --Izno (talk) 01:17, 14 January 2021 (UTC)
Depending on your definition of "embedded", you can find infoboxes embedded in sidebars in Template:Hindu philosophy, Template:Israeli–Palestinian peace process, Template:History of printing, Template:Archival records, Template:Military history of the Miꞌkmaq, Template:People of the Pāli Canon, Template:Syrian peace process, Template:Cyprus peace process and in the documentation for Template:Infobox. To generate some tracking, could probably do some string processing on the input to this module to find cases where tables (or table tags) are being passed in. I know Module:Infobox does some string processing to fix various issues (like embedded tables and categories) so I imagine it wouldn't be a disastrous amount of overhead. The first thing to do would be to address all the common cases, and then use string processing to find/fix and corner cases. Thanks! Plastikspork ―Œ(talk) 19:10, 14 January 2021 (UTC)
No, that fits the bill. I was skimming and didn't see it.
I am having trouble though countenancing that use in e.g. Hindu philosophy. I'll need to look at the rest you dragged up when I get a chance. --Izno (talk) 19:59, 14 January 2021 (UTC)

Width auto and similar sidebars

There's a pattern of sidebars that have a general pattern of something like |width=auto; to wit, they are setting the template to have a minimum width instead of an actual width.

I think for sidebars (without collapsibility) it would make sense to have this be the general default. It would look something like width: auto; max-width: 22em rather than the current width: 22em.

Caniuse has some intriguing things to say about it, so maybe it would be better once this is a div template? --Izno (talk) 20:09, 14 February 2021 (UTC)

Some relatively ancient discussion about widths in Module talk:Sidebar/Archive 3#More sophisticated default width setting?, Module talk:Sidebar/Archive 3#Edit request on 24 February 2013, Module talk:Sidebar/Archive 2#Edit request on 24 February 2013 for context. --Izno (talk) 21:21, 14 February 2021 (UTC)

Nomobile use

User talk:Jon (WMF)#nomobile is my current annoyance today and possibly some Minerva followups here and at MediaWiki:print.css. --Izno (talk) 02:46, 27 February 2021 (UTC)

Add subtitle parameter or something after title

Hello. Module:Sidebar/configuration really helps other wiki to translate this module. Is it possible to add subtitle parameter or something after title (before if args.image)? Because of grammatical difference, i sure some language needs it. For example, Template:Electromagnetism says "Articles about Electromagnetism". In order to correctly write this sentence in Bengali i need some parameter after title (Because Bengali is a Subject–object–verb#Bengali language).

Please add subtitle parameter or something after title. Add it but disable it for enwiki. So if any language needs it, they can enable it (Something like Module:Citation/CS1 does (look for "for those wikis that can and want to have English date names translated.."). Thank you. --আফতাবুজ্জামান (talk) 23:18, 22 March 2021 (UTC)

Difference in appearance

There appears to have been a change in the past few years in how (the classes that are now called) sidebar-heading and sidebar-list-title show up, resulting in inconsistencies in templates like Template:Culture of region. Compare the archived look ([1]) and the modern look ([2]): notice the difference in font size between the "History" and "People" headers, and how headers like "Monuments" are offset from their center-alignment by the "show/hide" button, resulting in an ugly effect. This may very well just require a local change at that template, but I am posting here since I don't know how to fix it, and in case it's something that needs wider scrutiny. — Goszei (talk) 03:17, 22 March 2021 (UTC)

I'll shortly add |centered collapsible titles= to the module. It can be set to anything to center text in sidebar list titles more appropriately. --Izno (talk) 17:25, 22 March 2021 (UTC)
This is an excellent fix, thank you. Should the parameter by set to 'yes' by default? I think it would be a general aesthetic improvement for those sidebars that use centered titles (Template:Antennas, Template:Palamism, Template:Love sidebar for some examples). There's a small concern about overlapping the title with the "[show]", but I believe that would affect a small minority of sidebars that use centering, where the parameter could be set in the other direction. — Goszei (talk) 03:26, 15 April 2021 (UTC)
No, setting the default to yes would center all headings in all templates, which I see no reason to do so. We have plenty of templates which use the default left text alignment.
I can make a more specific category if someone wants to target templates for conversion to the parameter. Izno (talk) 07:07, 24 April 2021 (UTC)