Jump to content

Template talk:Collapse top

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Want parameter to make the box as wide as the title, and left aligned

[edit]

Please see: Wikipedia talk:Manual of Style/Accessibility#Template:Collapse top, and Template:Collapse bottom.

I would like a parameter that makes the collapsed box as wide as the title and left aligned.

There is already a parameter to left align the title text. I am not talking about that. I want the box itself aligned to the left side of the page.

And I want the title text to wrap in narrower screens. --Timeshifter (talk) 16:54, 10 February 2024 (UTC)[reply]

Where do the "hide" and "show" come from?

[edit]

@Izno: someone who might have a clue. That is to say -- the texts "hide" and "show" in this template, they don't actually show up in the source text -- are they from common.js or something? jp×g🗯️ 00:10, 19 May 2024 (UTC)[reply]

I see that there's a MediaWiki:Collapsible-expand and a MediaWiki:Collapsible-collapse but I don't see how they're actually being invoked in this template. Through the JavaScript or what? jp×g🗯️ 00:12, 19 May 2024 (UTC)[reply]
mw:Manual:Collapsible elements. Izno (talk) 00:45, 19 May 2024 (UTC)[reply]

Cot bar skewed when collapsed in mobile

[edit]

The collapsed COT chart is displaying narrower than usual when collapsed, but is expands normally in mobile view. Can this minor issue be fixed? Qwerty284651 (talk) 21:51, 11 August 2024 (UTC)[reply]

Protected edit request on 4 September 2024

[edit]

Implement this version of the sandbox, to make the template night mode friendly. Andumé (talk) 04:57, 4 September 2024 (UTC)[reply]

Needs to have if subst wrapping the tag. IznoPublic (talk) 00:27, 16 September 2024 (UTC)[reply]
@Izno: Done —Matrix(!) {user - talk? - uselesscontributions} 19:20, 18 September 2024 (UTC)[reply]
The current sandbox does not indicate that what I suggested was done. Izno (talk) 17:24, 19 September 2024 (UTC)[reply]
@Izno: Sorry if I'm being thick but I don't understand what if subst wrapping is? —Matrix(!) {user - talk? - uselesscontributions} 17:31, 19 September 2024 (UTC)[reply]
{{ifsubst}} Izno (talk) 17:38, 19 September 2024 (UTC)[reply]
@Izno: Should be done now. I tested substitution at User:Matrix/sandbox and everything seems fine. —Matrix(!) {user - talk? - uselesscontributions} 20:29, 20 September 2024 (UTC)[reply]
... no, that was not the point in the slightest. {{ifsubst||<templatestyles src="Template:Collapse_top/styles.css"/>}} was the point. Izno (talk) 20:33, 20 September 2024 (UTC)[reply]
@Izno: We need the templatestyles statement or else it won't work. See User:Matrix/sandbox, where I tried substing it. I don't see the problem with having templatestyles in substitution anyway. —Matrix(!) {user - talk? - uselesscontributions} 12:42, 21 September 2024 (UTC)[reply]
The point of substing is to erase the fact a template was or is used to produce the wikitext. Leaving TemplateStyles tags is the opposite of that intent. See also WP:TemplateStyles which says "don't subst these tags". Izno (talk) 15:34, 21 September 2024 (UTC)[reply]
@Izno: Done, see results at User:Matrix/sandbox. I used the light-dark css function for the inline css. —Matrix(!) {user - talk? - uselesscontributions} 11:42, 22 September 2024 (UTC)[reply]
light-dark is too new to be used in a template used this widely. Izno (talk) 16:22, 22 September 2024 (UTC)[reply]
@Izno: There aren't any other options other than defining global rules (or a custom css token) at MediaWiki:Common.css if we still want dark mode to work during substitution IMO. Or we could persuade WMF to make a new design token. Thoughts? —Matrix(!) {user - talk? - uselesscontributions} 17:23, 22 September 2024 (UTC)[reply]
The solution is to make dark mode not work with substitution. Hence why I said we should ifsubst it. There's only so much that can be done to support dark mode for the time being. Izno (talk) 17:27, 22 September 2024 (UTC)[reply]
@Izno: Done. The top bar won't work with substitution but the inside will since that is controlled with design token. —Matrix(!) {user - talk? - uselesscontributions} 15:57, 23 September 2024 (UTC)[reply]

This still isn't formatting correctly when MathJax is inside the collapsible section. See for example Multivariable calculus, where all of the math renders in white-on-white in dark mode. FeRDNYC (talk) 17:35, 25 September 2024 (UTC)[reply]

@FeRDNYC: That's because the proposed edit has not been implemented yet in the live template. It seems to render fine when using the sandbox. Andumé (talk) 18:40, 25 September 2024 (UTC)[reply]

Incomplete background color in the title bar

[edit]

There is incomplete background color in a collapsed title bar at narrow window widths when the title string is short. See this VPT discussion for details. Excerpt:

{{cot}} is cutting off bg color in collapsed state on mobile. When expanded displays properly in Talk:List of Grand Slam and related tennis records#New versions. Is this a bug or a skin issue? Qwerty284651 (talk) 10:32, 20 September 2024 (UTC)[reply]

It's about window width. It also happens in narrow desktop windows but not in wide mobile windows. The green background always stops right after the "show" link. The difference in narrow windows is that the show link moves to the left. I don't know why. PrimeHunter (talk) 11:59, 20 September 2024 (UTC)[reply]
I've eliminated your table content as a factor; that does not affect it. But the length of the title field in the collapse bar does. The first cot/cob below shows the same problem, but the second does not:
{{Cot|Version 1}}
|-
| {{lipspan|1}}
|}

{{Cot|Version 1 - same, but with a longer title field; there must be a clue here somewhere}}
|-
| {{lipspan|1}}
|}
The generated Html for the first one looks like this:
Generated Html for top example:
<div style="margin-left:0">
{|  class="mw-collapsible mw-archivedtalk mw-collapsed " style="background: transparent; text-align: left; border: 1px solid Silver; margin: 0.2em auto auto; width:100%; clear: both; padding: 1px;"
|-
! style="background: #CCFFCC; font-size:87%; padding:0.2em 0.3em; text-align:center; " | <div style="font-size:115%;margin:0 4em">Version 1</div>   

|-
| style="border: solid 1px Silver; padding: 0.6em; background: White;" |
|-
| Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|}
Note that when expanded, the problem does not appear. Maybe this will help point the way to where to go next with this analysis. Mathglot (talk) 00:11, 21 September 2024 (UTC)[reply]
Here is a small example:
{| style="border: 1px solid"
|- style="background-color: cyan;"
| Test
|}
Test
In a narrow window, the table border is widened to the full width but the background color is not included in the widened part. Tested in Firefox in Vector 2022 and Vector legacy. PrimeHunter (talk) 09:34, 21 September 2024 (UTC)[reply]
Again the content length matters:
{| style="border: 1px solid"
|- style="background-color: azure;"
| testing whether that nation, or any nation so conceived and so dedicated, can long endure
|}
testing whether that nation, or any nation so conceived and so dedicated, can long endure
Problem gone again. But why? Mathglot (talk) 11:14, 21 September 2024 (UTC)[reply]
Also MonoBook. It's this rule:
@media screen {
  @media (max-width: 639px) {
    .mw-parser-output table {
      display: block;
      overflow: auto;
      max-width: 100%;
    }
  }
}
For a table, the display: property defaults to display:table; which would cause that max-width: 100%; declaration to be ignored, but this rule overrides it. --Redrose64 🌹 (talk) 13:44, 21 September 2024 (UTC)[reply]
It's an unknown table, so the table defaults kick in (to allow for scrolling, in case the thing is superwide). Those defaults do not take into that something has a colored background like that and by default, the background for that element will thus not be maximum width wide, but content wide. —TheDJ (talkcontribs) 00:53, 22 September 2024 (UTC)[reply]
Have you taken the step of grabbing the right edge of your browser window, and slowly dragged it left, until you see a jump in the background color of the title bar to half the width of the title bar (meaning the right half has white backgroundd) as the window shrinks to 1/3 or 1/5 of its former width? How is your explanation related to this behavior? And, what is an "unknown table"? Mathglot (talk) 01:21, 22 September 2024 (UTC)[reply]
This would effectively be fixed if someone took the time to convert {{collapse top}} and any bottom templates (collapse bot, possibly others) to use divs rather than tables. They will need to be point person on any issues that come up. I can support. (I just don't have it in me to do it by myself. :) Izno (talk) 16:27, 22 September 2024 (UTC)[reply]
@Xaosflux: Qwerty284651 (talk) 17:09, 22 September 2024 (UTC)[reply]

Mathglot (talk) 22:25, 22 September 2024 (UTC)[reply]