Module talk:Sidebar/Archive 7

Archive 1Archive 5Archive 6Archive 7

Option to omit nomobile?

@Izno: At Module talk:Sidebar/Archive 6#How to override "class=nomobile" to display sidebar in mobile view? you said "This cannot be overridden and that will not change". Did you only mean that there is no way to override an existing class=nomobile, or did you rule out adding a new sidebar option like mobile=yes to omit class=nomobile? I came from a discussion about {{NGC objects}} at Wikipedia:Templates for discussion/Log/2025 January 4#Template:NGC objects. A long list is split into intervals so the articles are closer tied together than normal sidebars and this sidebar is very narrow. I think an option to omit nomobile would sometimes be nice. PrimeHunter (talk) 16:45, 4 January 2025 (UTC)

Ruling both out. I can reinstate vertical-navbox if we prefer just to make it more opaque ;). It's not about how narrow or wide sidebars are, it's about how much HTML they dump into the page that isn't used in mobile. Izno (talk) 20:19, 4 January 2025 (UTC)
Which maybe doesn't make my true preference clear of course - which is that everything is displayed at all resolutions (or at least until this module is deleted, which is probably my truest preference, for various reasons). What I'm doing is respecting the WMF's choice to remove these elements from mobile. Izno (talk) 20:22, 4 January 2025 (UTC)

Should there be a way to automatically open up the relevant section of the sidebar?

After Template:Feminism sidebar got reorganized, a bunch of transclusions no longer automatically expand the correct section. For example, the article Feminist theory in composition studies automatically expands the "Concepts" section even though the article is now listed under the "Theory" section. Something I realized is that expanding the section that contains a link to the current article might be something that could be done automatically, so that editors no longer have to manually specify the section to auto-expand on every article where a sidebar is included. PBZE (talk) 19:39, 27 January 2025 (UTC)

How get "alt" text for the image

In article Atlanta Compromise, it is using an InfoBox Template:Nadir of American race relations .. that infobox has an image in it. How can I add "alt" text for the image, to assist visually impaired users of the encyclopedia? I couldn't find instructions for alt text in this module page. Noleander (talk) 01:39, 10 May 2025 (UTC)

@Noleander: Template:Nadir of American race relations has
{{Sidebar with collapsible lists
...
| image = [[File:Le Petit Journal 7 Oct 1906 (cropped).jpg|232px|class=notpageimage]]
...
}}
and you would add the alt text inside that image specification using |alt=, see WP:EIS#Alt text and caption. --Redrose64 🌹 (talk) 12:57, 10 May 2025 (UTC)
Great, thanks, that worked. Noleander (talk) 13:13, 10 May 2025 (UTC)

I noticed that when a wrapper of this template is called on the page the title parameter links to, the title renders as the link color despite not actually being a link. This doesn't align with the default behavior when a page links to itself (e.g.: Module talk:Sidebar/Archive 7) or the behavior when a non-title link in a sidebar links to the page it's placed on. It's also possible that this violates the Links should be clearly identifiable as links for readers clause of MOS:COLOR (it doesn't conform to the inverse, i.e. that non-links shouldn't appear as links).

My Lua knowledge is limited at best so I have no idea what/who (and, by extension, why) caused this. Any thoughts?

— Daℤyzzos (✉️ • 📤) 20:18, 29 July 2025 (UTC)

@DaZyzzogetonsGotDaLastWord: On which page do you see this happening? Examples always help. --Redrose64 🌹 (talk) 21:03, 29 July 2025 (UTC)
First noticed it on Mathematics. – Daℤyzzos (✉️ • 📤) 23:22, 29 July 2025 (UTC) P.S. Just realized this—only happens on dark mode (probably should've checked that earlier, but oh well.) Also: using Chrome but also shows up in Safari on my phone (again only in dark mode). – Daℤyzzos (✉️ • 📤) 23:28, 29 July 2025 (UTC)
This also occurs using Firefox, again dark mode only. The HTML that is served has
<table class="sidebar nomobile nowraplinks hlist">
  <tbody>
    <tr>
      <td class="sidebar-pretitle">Part of a series on</td>
    </tr>
    <tr>
      <th class="sidebar-title-with-pretitle">
        <a class="mw-selflink selflink">Mathematics</a>
      </th>
    </tr>
    ...
  </tbody>
</table>
In both dark and light mode, this comes with the following CSS:
@media screen {
  a.mw-selflink {
    color: inherit;
    font-weight: bold;
    text-decoration: inherit;
  }
}
which is what makes the word "Mathematics" appear black and boldface. But in dark mode only, the following CSS (found in Module:Sidebar/styles.css) is used in addition:
@media screen {
  html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a {
    color: var(--color-progressive) !important;
  }
}
The last three simple selectors (.sidebar:not(.notheme) .sidebar-title-with-pretitle a) are what's causing the color to be overridden. The color value (var(--color-progressive)) is read from a variable that is set elsewhere. Why it's written that way, I don't know. --Redrose64 🌹 (talk) 07:10, 30 July 2025 (UTC)
I did some WikiBlame-ing and discovered that the last bit of CSS in your comment (the @media screen one) was added in this edit to the style page by @Jdlrobson (pinging to find the reasons for the addition as the link in the edit summary is broken and a search for "Fall of Constantinople dark mode error" on talk pages turned up blank). – Daℤyzzos (✉️ • 📤) 13:20, 30 July 2025 (UTC)

Removing sidebar images as page image

(continuation of Module talk:Sidebar/Archive 6#Removing sidebar images as page image)

@Izno: I've added notpageimage to the sandbox and its configuration. The RedBurn (ϕ) 06:36, 30 August 2025 (UTC)

@The RedBurn Unfortunately, the class needs to be on the [[File: syntax and not on a container of that item.
(NB make sure the ping is attempted in the same edit as you sign.) Izno (talk) 16:53, 1 September 2025 (UTC)
@Izno: I've updated the sandbox to add the class to the [[File: part. The RedBurn (ϕ) 14:54, 2 September 2025 (UTC)
Good start. In the else case, what about when there is arbitrary HTML in the parameter? Izno (talk) 15:55, 2 September 2025 (UTC)
Or a link (or links) in the if branch. Izno (talk) 15:56, 2 September 2025 (UTC)
Per Template:Sidebar#Parameters it's supposed to be full wiki syntax ([[File:).
I'm not sure what you mean by "a link (or links) in the if branch". The RedBurn (ϕ) 18:17, 2 September 2025 (UTC)
it's supposed to be full wiki syntax Assuming without evidence that people follow the documentation or any expectations at all is a bad idea. :) That's how we got a failed "divification" of this template (and I'm sure many other failed rollouts of other software over the years).
a link (or links) in the if branch I realize I read this wrong in hindsight, but I think it rolls back around to the first comment about assuming the documentation is king.
We need/want to substantiate your claim that the documentation reflects reality about the use of the image arguments or make something a bit more resilient to all the fun things users do. Izno (talk) 18:57, 2 September 2025 (UTC)
I've just checked it out on Template:Greek mythology sidebar.
With [[Greek mythology|class=notopimage]] the "image" is shown as class=notopimage instead of Greek mythology.
With <img src="Kylix Theseus Aison MNA Inv11365 n1.jpg">class=notopimage]] it shows up as <img src="Kylix Theseus Aison MNA Inv11365 n1.jpg">class=notopimage]] which isn't much worse than without the "class=notopimage]]" bit. I seriously doubt that's actually used for that parameter.
I don't see the point in making the code more complex for these two cases. The RedBurn (ϕ) 21:22, 2 September 2025 (UTC)
Why would we expect raw image HTML, which is distinctly not a possibility in this environment?
I'm talking the basic <div class=""> or {| class="", either of which one might find in this element (possibly by transcluded content - as a particular example, {{Politics sidebar title}}, which is supposed to be put in |title= but that doesn't stop people).
And I think the former case is precisely something to concern oneself with. Users on this wiki if nowhere else don't like anything breaking, whether or not their understanding is calibrated correctly.
NB I am not trying to make your life difficult. I am pointing out that the masses will come for anyone who didn't consider factors like the above and account for them directly in what is deployed. Izno (talk) 21:47, 2 September 2025 (UTC)
That specific example {{Politics sidebar title}} wouldn't matter because it doesn't use the image arg, but I get your point.
I've added a sanity check for [[File: or [[Image:.
Incidentally, I've fixed it to use the correct notpageimage class. The RedBurn (ϕ) 06:36, 3 September 2025 (UTC)
@The RedBurn: Please see my post of 12:57, 10 May 2025 (UTC) for the method of adding a class to an image. --Redrose64 🌹 (talk) 19:33, 3 September 2025 (UTC)
The modification proposed for the module is intended to add that class automatically to the templates that use this module. The RedBurn (ϕ) 20:35, 3 September 2025 (UTC)
@Izno: Are there any remaining problems? The RedBurn (ϕ) 16:50, 20 October 2025 (UTC)

How come this thing still uses tables?

I just replaced all table elements with <div> in the sandbox and it has exactly the same appearance in all testcases except one (Politics of Panama). So how come this thing still uses tables? sapphaline (talk) 16:55, 8 December 2025 (UTC)

Your edits created a bunch of Linter errors at Template:Sidebar/testcases. I've already cleaned up after you at Template:Infobox rugby biography/sandbox today. Please clean up after yourself when you are done. Thanks. – Jonesey95 (talk) 20:30, 8 December 2025 (UTC)

Images on mobile

I was recently reviewing @Noleander's FAC nomination of Bridge, which uses the {{Bridge sidebar}} sidebar in the lead section. That sidebar (like many others) includes an image, which is effectively the lead section's visual. I noticed that, because the sidebar is configured not to display on mobile, it results in there being no lead image on mobile.

Would it be possible for this module to detect when there is an image in a sidebar and display that on mobile, even when the sidebar as a whole is not? (Perhaps we'd want to limit it to lead sections.) Or would that be too technically complicated/introduce other complexities, in which case it might be better to implement on a per-article basis using {{If mobile}}? Sdkbtalk 21:02, 13 December 2025 (UTC)

ARIA

Hi, per WIA-ARIA, can the parent <table> HTML element with classes sidebar sidebar-collapse nomobile nowraplinks please get an ARIA role. Like the Mbox templates (see Module:Message box, I was thinking role="none" is most appropriate. Although, in this case since most sidebars are navigation boxes it may be helpful to able to pass a boolean parameter to change the ARIA role given to role="navigation".

@Izno What do you think? Sorry, I'm browsing around with my screenreader and noticed the sidebar also uses HTML tables still... Are you also on-board with role="none" and a boolean argument to switch this to role="navigation"?

(P.S. future me or someone else kind enough I can proof it—will have to also explain clearly and succinctly in sidebar and sidebar with collapsible lists template docs how to use lists (that expose <ul>, <li>, etc.) and be ARIA-friendly i.e. grouping them so they're read out usefully, labelling (!!) so important as otherwise a long babelling electronic voice of hyperlinks is all the visually impaired has for reference etc. if this is even possible to achieve on WP...) waddie96 ★ (talk) 02:47, 1 September 2025 (UTC)

Sidebars are either nav or aside, if we were to use HTML elements that I don't current have access to. I'll mark it up as nav for now in the sandbox. Izno (talk) 16:57, 1 September 2025 (UTC)
Thanks. I'm pretty confident that this particular WIA-ARIA work such as assigning roles to HTML elements whose semantics are incongruent to their use-case is an uncontroversial edit despite it being such a high-use page. Placing edit request.
Kindly at the HTML attribute role="navigation" to the parent <table> element please. This will replace the implicit semantics of a data table with the explicit semantics of a navigation group/group of links (the identical semantics as <nav>) to accessibility technology.
I guessed this, so please don't slate me:
:css('width', args.width or nil) :cssText(args.bodystyle or args.style)
+
:css('width', args.width or nil) :cssText(args.bodystyle or args.style) :attr("role", "navigation")
or is it setAttribute("role", "navigation")? I feel like the former.waddie96 ★ (talk) 17:39, 1 September 2025 (UTC)
Or you can just say sync to the sandbox. Izno (talk) 19:13, 1 September 2025 (UTC)
Not done for now':' Going to wait until RedBurn finishes their work. Izno (talk) 15:56, 2 September 2025 (UTC)
Good day @Izno. Please can you just insert the code I posted below for now. There's no timeline how long it may take the sandbox editing/testing to finish, and this edit won't need much testing beyond me checking ten or so use-cases that it actually shows up... At line 156, insert the highlighted code:
	root = root:tag('table')
	if not child then
		root 
			:addClass(cfg.i18n.class.sidebar)
			-- force collapsibleclass to be sidebar-collapse otherwise output nothing
			:addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil)
			:addClass('nomobile')
			:addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil)
			:addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil)
			:addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil)
			:addClass(args.bodyclass or args.class)
			:css('width', args.width or nil)
			:attr('role', 'presentation')
			:cssText(args.bodystyle or args.style)
Thank you waddie96 ★ (talk) 16:19, 7 September 2025 (UTC)
The reason I have not done so is because we expect to have two changes and I'm preventing the WP:Job queue from having to swallow two in some relatively quick procession (editing highly used modules has been observed by the WMF before). Users have lived with the change for many many years and is relatively minor at the end of the day. There is also 0 reason to test it any further. You should move on to more productive activities. And lastly, setting role to presentation is already what we're not doing. Izno (talk) 16:29, 7 September 2025 (UTC)
Ah ok got you. Thanks for the education 😄. Observed meaning it was able to cause enough performance issues that WMF was able to track the cause all the way down to a module? Insane.
You should move on to more productive activities. Please watch your tone though. waddie96 ★ (talk) 20:19, 7 September 2025 (UTC)
If it’s in retaliation because I came across with tone I do apologise, the web doesn’t come with emotion semantics unless you use an emoticon 😅 waddie96 ★ (talk) 20:21, 7 September 2025 (UTC)
@Waddie96 I went ahead and implemented :attr("role", "navigation") along with some other changes I was making, since The RedBurn's changes above appear to be stalled. --Ahecht (TALK
PAGE
)
18:12, 29 December 2025 (UTC)

Please adjust line-height to be in keeping with the increase at {{infobox}}.

.sidebar {
    line-height: 1.5em;
}

waddie96 ★ (talk) 04:49, 14 September 2025 (UTC)

Reason being: Currently, links etc. will be too bunched together, and it actually makes it 'harder' to read from an usability perspective since it appears busy/cluttered and 'a lot'. waddie96 ★ (talk) 04:49, 14 September 2025 (UTC)
As always with this editor: Where are the links to test cases? This module is used in 400K+ pages. Also, please link to the relevant "increase at {{infobox}}". – Jonesey95 (talk) 14:57, 18 September 2025 (UTC)

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.