Module talk:Sidebar
| Text and/or other creative content from this version of Module:Sidebar was copied or moved into incubator:Module:Wp/nod/Sidebar with this edit. The former page's history now serves to provide attribution for that content in the latter page, and it must not be deleted as long as the latter page exists. |
| Related pages |
|---|
ARIA
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
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)
- or is it
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: Thank you waddie96 ★ (talk) 16:19, 7 September 2025 (UTC)
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)
- 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)
- @Waddie96 I went ahead and implemented
- 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)
- 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:
This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
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)
How come this thing still uses tables?
[edit]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
[edit]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}}? Sdkb talk 21:02, 13 December 2025 (UTC)
Alternative text for image
[edit]I added a brief instruction on how to provide alternative text for the sidebar image, as is required for WP:ALT. This is not an obscure detail: I had no idea how to do it 10 months ago, and I posted a query here in this Talk page, and got an answer. Then the same question came up yesterday in an FAC review. There may be lots of editors that have tried to help blind users by adding alt text to sidebar images, and gave up. The mechanism is not at all obvious, even to experienced editors, because many expect the "alt" attribute to be a sibling of the "image" attribute So, I added instructions. I inserted the instructions within the "image" attribute explanation. Noleander (talk) 15:17, 10 March 2026 (UTC)