Template talk:Collapsed infobox section begin

Warning conditonals
Am I correct in assuming that when this script is copied into a parameter- that later is used as a test- than it will blow the code


 * other_parameter_1= blah
 * yes=yes


 * other_parameter_2= blah


 * other_parameter_3= blah

If so shouldn't it be marked in the documentation -- Clem Rutter (talk) 16:29, 17 March 2013 (UTC)
 * it should only be used in fields that directly generate visible information, so putting it in fields that set the colouring, image size, English variation, ... will not work properly. feel free to add to the documentation. Frietjes (talk) 17:04, 17 March 2013 (UTC)

Uncollapsed option
As it is at present, the default display is collapsed. Would it be possible to add an optional uncollapsed parameter, which will allow infobox sections to be uncollapsed by default, with a [hide] button in the section heading? - André Kritzinger (talk) 18:19, 9 January 2016 (UTC)
 * André Kritzinger, sure, see the doc. Frietjes (talk) 16:38, 11 January 2016 (UTC)
 * Thanks, Frietjes. I tried my luck with Template:Infobox locomotive, and I think I got the hang of it, sort of - see User:Andre Kritzinger/Sandbox. One more thing I'd still need to be able to do, though, is to add (retain) the background colour of the sub-titles (background-color: #eeb47f). People tend to get seriously upset when the appearance of an infobox suddenly changes drastically.... - André Kritzinger (talk) 22:46, 11 January 2016 (UTC)
 * André Kritzinger, for that application, there is a much better method. I have adjusted your sandbox to show you. Frietjes (talk) 14:56, 12 January 2016 (UTC)
 * Wow, Frietjes, if you're ever in Cape Town, remember I owe you one! That's exactly what I wanted! - André Kritzinger (talk) 18:00, 12 January 2016 (UTC)

mw-collapsible
Maybe the old  class should be retained for this template, since the header colour can be changed and this can cause readability problems since the show/hide button is always blue (as opposed to being the colour of the surrounding text). Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125; to reply to me 13:33, 29 May 2017 (UTC) to reply to me 17:21, 29 May 2017 (UTC)
 * Hmm. something to consider indeed. Issue T63018 is still a problem I guess. Or maybe we should just finally get that problem fixed. —Th e DJ (talk • contribs) 14:56, 29 May 2017 (UTC)
 * fixed —Th e DJ (talk • contribs) 16:32, 29 May 2017 (UTC)
 * Example: Template:Collapsed_infobox_section_begin/testcases. —Th e DJ (talk • contribs) 16:35, 29 May 2017 (UTC)
 * Thanks! I didn't know that was possible. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * Well only relatively recently. Took me some time to figure out an appropriate strategy to apply this, and there might be edge cases where it fails, but one problem at a time. —Th e DJ (talk • contribs) 18:54, 29 May 2017 (UTC)

to reply to me 05:03, 8 June 2017 (UTC) to reply to me 15:52, 9 June 2017 (UTC) to reply to me 16:00, 9 June 2017 (UTC) to reply to me 16:05, 9 June 2017 (UTC) to reply to me 16:19, 9 June 2017 (UTC) Sigh... how are we EVER going to make progress this way. This is the very definition of bikeshedding honestly.. I'm sure I can find 1 other user who thinks the button is too small.. Then what ? Sit still in grid lock till eternity ? —Th e DJ (talk • contribs) 17:19, 9 June 2017 (UTC) to reply to me 15:15, 10 June 2017 (UTC) to reply to me 12:39, 13 June 2017 (UTC)
 * Hey there, would it be possible to reduce the size of the collapse button to 90% rather than 95%, per Template:Hidden begin? Thanks.--Nev&eacute;–selbert 17:17, 7 June 2017 (UTC)
 * Why would this be needed? Neither template has any CSS controlling the size of the collapse button relative to the header text. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * It's preferable since the 95% size looks utterly unaesthetic, and is inconsistent with other templates which use 90%.--Nev&eacute;–selbert 19:15, 8 June 2017 (UTC)
 * I'm sorry, but I have no idea what you're referring to. There is no CSS for 90% size or 95% size in either template. The button is the same size as the header text, which is the same size as every other infobox header. Or am I misunderstanding you? (I've updated the template to prevent the header from being too narrow compared to normal headers, if that's what you were referring to.) Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * What I was trying to say is that the size of the button here is larger than the size at Template:Hidden begin, which is rather strange.--Nev&eacute;–selbert 15:55, 9 June 2017 (UTC)
 * Oh, sorry, the button size for Hidden begin is slightly different, because it uses a different type of collapsing box (there are three of them). I didn't think it was very noticeable, though. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * It looks quite fugly IMO using the skin I'm using at the moment in editing. I would much rather you change it back.--Nev&eacute;–selbert 16:03, 9 June 2017 (UTC)
 * Does Monobook (or the skin you're using) have different CSS rules for infobox border padding? Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * I think it does, yes. It isn't just that though, the aesthetics of the button being the same fontsize as the text just looks wrong.--Nev&eacute;–selbert 16:09, 9 June 2017 (UTC)
 * I've reverted the change; filed phab:T167522. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * I've updated Hidden begin/sandbox to use, and   (which I didn't know existed); although there are still issues since I just changed the CSS classes and nothing else. For one thing there's no documentation on how to align the button to the left, so that doesn't work in the testcases. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * I've improved Hidden begin/sandbox a bit and adapted the site wide CSS for mw-collapsible toggles a bit, so that everything is a tad more similar. —Th e DJ (talk • contribs) 15:06, 12 June 2017 (UTC)
 * I think the new class name could be changed to just  or even   (to avoid problems with RTL wikis), but other than that it's a nice improvement. Thanks.
 * Would it be possible to port this (and the font colour change) back into MediaWiki? Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;

Is this still maintained at all?
I tried to use this template, for an article with multiple infoboxes that would benefit from minimizig, but I ended up with most of the infoboxes still being there. The intent was to have just the name there, but even if the photo was removed, the map would stay there, taking up just as much space.

It also seems to force a css clear that wildly throws off any image in the meantime, even if it's on the other side. SilverbackNet talk 14:05, 15 February 2019 (UTC)
 * SilverbackNet, if you want help, you should provide an example. Frietjes (talk) 16:18, 15 February 2019 (UTC)

LintHint errors
This template throws HTML errors when tested using WP:LintHint I can't edit template-protected pages, nor would you want me to. Could someone please fix these errors? --Guy Macon (talk) 05:46, 25 November 2020 (UTC)
 * Uses of this template do so or this specific template page does so? --Izno (talk) 18:10, 25 November 2020 (UTC)
 * , I think uses? and I are coming from Talk:COVID-19_pandemic/Archive 41, where he removed the collapsing to get rid of the error, but we'd like to restore the behavior of having the collapsed sections. &#123;{u&#124;  Sdkb  }&#125;  talk 18:14, 25 November 2020 (UTC)
 * Both, actually. You can see errors at COVID-19 pandemic by looking at the last version before I removed the collapse, and there is an extensive discussion about the technical details of the errors on the article talk page. That being said, LintHint also show errors on this page. I am with Sdkb in thinkling that if the editors of the Covid page want collapsing they should get collapsing, but without it generating HTML errors. --Guy Macon (talk) 18:28, 25 November 2020 (UTC)
 * It's not fundamentally a problem with, which works by terminating the current table cell and row and starting a new row, with a double-width cell containing a nested table, which itself is collapsible. This works fine with most infobox rows, where it is used in a cell where the innermost unclosed element is the  itself. The problem at COVID-19 pandemic, which uses , is that it uses the legend as an image caption, and the underlying Module:Infobox wraps the caption (i.e. the contents of the legend parameter) in a . Now, if you put a into a legend parameter, you're using a  when the innermost unclosed tag is a , then the infobox code supplies a  when the innermost unclosed tag is a . Similarly, if you put a  into a legend parameter, you're using a  when the innermost unclosed tag is a . These unbalanced tags are what lint errors are all about. -- Red rose64 &#x1f339; (talk) 23:42, 25 November 2020 (UTC)
 * , hmm, okay. That's largely over my head. What would you suggest we do about it to get the collapsing behavior we want without creating a lint error? &#123;{u&#124; Sdkb  }&#125;  talk 07:03, 28 November 2020 (UTC)
 * Put briefly: HTML elements may be nested (to any depth) but must be closed in reverse order so that they don't overlap. Putting or  inside the legend parameter of  causes misnesting - closing tags are occurring in the wrong order, or are appearing when not relevant. I'm sorry, but if you don't understand HTML fundamentals like this, please stay away from lint errors. Fixing them requires an understanding of HTML. -- Red rose64 &#x1f339; (talk) 21:42, 28 November 2020 (UTC)
 * , I'm only here since I care about the collapsing of the infobox maps at COVID-19 pandemic, not since I have any helpful technical expertise. I wish I could just fix it myself, but I'm not at that point. I hope that you or others who know more what they're doing will be able to fix the template so that it works properly (or make whatever other changes might be needed to allow us to get the behavior we want). &#123;{u&#124; Sdkb  }&#125;  talk 22:08, 28 November 2020 (UTC)
 * I added an optional y to the begin and end templates to inject extra div tags when used inside of captions. Thanks! Plastikspork ―Œ (talk)  12:51, 10 December 2020 (UTC)
 * That fixed the COVID-19 pandemic page. Thanks! Should I be concerned that LintHint still shows a "Missing end tag: div" and "Stripped tags: div" error when run on this template? --Guy Macon (talk) 15:17, 10 December 2020 (UTC)
 * Guy Macon, did [//en.wikipedia.org/w/index.php?title=Template%3ACollapsed_infobox_section_begin%2Fdoc&type=revision&diff=993425699&oldid=973908885 this change] fix it? Plastikspork ―Œ (talk) 15:34, 10 December 2020 (UTC)
 * Yes. No errors now. Template:Collapsed infobox section end also has no errors. Good job! --Guy Macon (talk) 16:11, 10 December 2020 (UTC)

Errors are widespread. I came here from Draft:Nafis Amin, where this template is causing stripped tags for and ; I went to Special:WhatLinksHere/Template:Collapsed_infobox_section_begin and started checking the first five, and of those, Albanians and Clement Attlee both have stripped tags attributable to this template.

Separately, this template presents some issues. It it is premised on the notion that infobox markup has sections, but in reality, infobox markup, like all template markup, allows parameters in any order. The following two markups for Albert Einstein render the same:

But now if we throw in "collapsed section" what is that supposed to mean if the parameters listed between beginning and end are not rendered in a contiguous group in the infobox?

This very example has three lint errors: a missing end tag for and stripped tags for  and. (At some point in the future I reserve the right to comment out the rendered example to make these lint errors go away.)

I object to markup that breaks the model that template parameters can be listed in any order. I won't campaign for deleting this template, but I am campaigning here for the documentation to be improved to explain how ... must wrap parameters that render as a contiguous block, and how in general to avoid lint errors.

Also, the documented example includes markup commenting out the newline just before. But that commenting-out markup doesn't seem to make any difference. If it serves no purpose, it should be removed. If it serves some purpose, it should be explained. —Anomalocaris (talk) 23:37, 3 October 2021 (UTC)

Template-protected edit request on 8 February 2023
I noticed a display error of this template in the case that the hidden content has more than two columns like medal tables. Is it possible to expand the "colspan"-attribute to 3 columns (or more)?

On the right is a shortened example where this template does not correctly work. In collapsed mode, the header (here named "Medal list") looks fine, but if you click on "show", it jumps to the left and doesn't span the last column. Henni147 (talk) 15:47, 8 February 2023 (UTC)


 * I've added a columns parameter which might do the trick. Would you mind testing Collapsed infobox section begin/sandbox to check if it works or not? &mdash; Martin (MSGJ · talk) 15:41, 9 February 2023 (UTC)
 * Thank you very much for your reply! Is it enough to copy my testcase to the sandbox page (above the documentation template for example), add, and check if the testcase is correctly displayed in the preview? I am not familiar with template sandboxes, so I want to make sure that I do it right. Henni147 (talk) 15:56, 9 February 2023 (UTC)
 * Please see Template:Collapsed infobox section begin/testcases. It's not working yet because the "Medal list" has disappeared &mdash; Martin (MSGJ · talk) 16:01, 9 February 2023 (UTC)
 * Yes, the example in the sandbox section works correctly. Thank you very much! Henni147 (talk) 16:06, 9 February 2023 (UTC)
 * Okay that's deployed. If you don't mind, could you update Template:Collapsed infobox section begin/doc with the instructions for the new parameter? I feel there should be an easier way to do this, but it seems to work for now! &mdash; Martin (MSGJ · talk) 16:28, 9 February 2023 (UTC)
 * Yes, I can update the doc page. Thank you very much! Henni147 (talk) 16:30, 9 February 2023 (UTC)

lint errors: th
I'm recently editing railway station articles with many years of passenger number data, and decided to halve them. However, a user pointed out that my edit causes lint errors and I fixed it by adding  and removing , but   error remains. Can someone fix this error? Below is an extract from the page. Thanks! Purin128AL (talk) 13:34, 12 June 2023 (UTC)
 * If you insist on hiding content contrary to MOS:HIDE, I think that this usage may require an adjustment to Infobox station, where mpassengers lives in header62 instead of in a  value. An adjustment to that template may yield good results, though they would need to be tested thoroughly, since the template is so widespread. – Jonesey95 (talk) 14:33, 12 June 2023 (UTC)
 * If you feel the need to hide the content, why not just remove it from the infobox and let it live in the body of the article? The infobox is to summarize key information, not to have everything in it. If you hide information, it's probably a sign it doesn't belong there. Gonnym (talk) 18:09, 12 June 2023 (UTC)
 * I will revert the edits then to prevent errors for now, as  uses the template  which would require lots of testing and edit to these two templates.
 * What information should be kept will be discussed in the new WikiProject Council/Proposals/Australian Transport then remove excess information as appropriate. Purin128AL (talk) 06:05, 13 June 2023 (UTC)

Strange possible fix for Linter stripped th tag associated with this template
This template can be a pain when it comes to causing Linter errors. I just stumbled across this possible fix for a stripped tag: I placed the Collapsed infobox section end at the end of the embedded child template, before the closing braces, and now there are no more Linter errors. The display remained fine. I haven't taken the time to parse out why this appears to work, or if it is a Linter parsing bug (either a false positive or a false negative), but I just thought I would leave this here for future reference. Comments are welcome. – Jonesey95 (talk) 19:56, 8 February 2024 (UTC)