Module talk:Sidebar: Difference between revisions

Content deleted Content added
ARIA: Reply
 
(20 intermediate revisions by 6 users not shown)
Line 3:
| minthreadsleft = 4
| minthreadstoarchive = 1
| counter = 67
| algo = old(90d)
| archive = Module talk:Sidebar/Archive %(counter)d
Line 15:
{{archives|search=yes|bot=MiszaBot II|age=90}}
{{Lua sidebar}}
 
== Treating [[Module:Navbar/styles.css]] ==
 
{{ping|Izno}} Is it right not to treat [[Module:Navbar/styles.css]] in add_list_styles() whether sidebar has a navbar or not? If an article page transcludes a sidebar (with a navbar) and another navbar in this order, the styles doesn't seem to be applied on mobile view. [[User:本日晴天|本日晴天]] ([[User talk:本日晴天|talk]]) 15:42, 24 December 2024 (UTC)
 
:add_list_styles is just for the two kinds of lists and is about the classes that have been added since eternity in the several templates (infobox also). Both navbox and sidebar have instead move_hiding_templatestyles which will take care of embedded TemplateStyles tags. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 17:32, 24 December 2024 (UTC)
::Okay, but on some pages (ex. [https://en.m.wikipedia.org/wiki/Finder_(software)#Timeline Finder_(software)]) on mobile view, navbars are actually displayed in unintended styles because [[Module:Navbar/styles.css]] isn't used. How about modifying this module [[Special:Diff/1129707986/1265334216|like this]] and output an additional templatestyles tag if navbar is used? [[User:本日晴天|本日晴天]] ([[User talk:本日晴天|talk]]) 08:19, 27 December 2024 (UTC)
 
== Option to omit nomobile? ==
 
{{ping|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 <code>class=nomobile</code>, or did you rule out adding a new sidebar option like <code>mobile=yes</code> to omit <code>class=nomobile</code>? I came from a discussion about {{tl|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. [[User:PrimeHunter|PrimeHunter]] ([[User talk:PrimeHunter|talk]]) 16:45, 4 January 2025 (UTC)
 
:Ruling both out. I can reinstate <code>vertical-navbox</code> 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. [[User:Izno|Izno]] ([[User talk: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. [[User:Izno|Izno]] ([[User talk: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. [[User:PBZE|PBZE]] ([[User talk:PBZE|talk]]) 19:39, 27 January 2025 (UTC)
 
== How get "alt" text for the image ==
Line 51 ⟶ 33:
 
&mdash;&hairsp;[[User:DaZyzzogetonsGotDaLastWord|Daℤyzzos]] ([[User_talk:DaZyzzogetonsGotDaLastWord|✉️]]&nbsp;•&nbsp;[[Special:Contributions/DaZyzzogetonsGotDaLastWord|📤]]) 20:18, 29 July 2025 (UTC)
:{{replyto|DaZyzzogetonsGotDaLastWord}} On which page do you see this happening? Examples ''always'' help. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 21:03, 29 July 2025 (UTC)
::First noticed it on [[Mathematics]].{{snd}}[[User:DaZyzzogetonsGotDaLastWord|Daℤyzzos]] ([[User_talk:DaZyzzogetonsGotDaLastWord|✉️]]&nbsp;•&nbsp;[[Special:Contributions/DaZyzzogetonsGotDaLastWord|📤]]) 23:22, 29 July 2025 (UTC) <ins>P.S. Just realized this&mdash;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).{{snd}}[[User:DaZyzzogetonsGotDaLastWord|Daℤyzzos]] ([[User_talk:DaZyzzogetonsGotDaLastWord|✉️]]&nbsp;•&nbsp;[[Special:Contributions/DaZyzzogetonsGotDaLastWord|📤]]) 23:28, 29 July 2025 (UTC)</ins>
:::This also occurs using Firefox, again dark mode only. The HTML that is served has <syntaxhighlight lang=html><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></syntaxhighlight> In both dark and light mode, this comes with the following CSS: <syntaxhighlight lang=css>@media screen {
a.mw-selflink {
color: inherit;
font-weight: bold;
text-decoration: inherit;
}
}</syntaxhighlight> 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: <syntaxhighlight lang=css>@media screen {
html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a {
color: var(--color-progressive) !important;
}
}</syntaxhighlight> The last three simple selectors (<code>.sidebar:not(.notheme) .sidebar-title-with-pretitle a</code>) are what's causing the color to be overridden. The color value (<code>var(--color-progressive)</code>) is read from a variable that is set elsewhere. Why it's written that way, I don't know. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 07:10, 30 July 2025 (UTC)
::::I did some [[WP:WikiBlame|WikiBlame]]-ing and discovered that the last bit of CSS in your comment (the <code>@media screen</code> one) was added in [[Special:Diff/1234103998|this edit]] to the style page by @[[User:Jdlrobson|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).{{snd}}[[User:DaZyzzogetonsGotDaLastWord|Daℤyzzos]] ([[User_talk:DaZyzzogetonsGotDaLastWord|✉️]]&nbsp;•&nbsp;[[Special:Contributions/DaZyzzogetonsGotDaLastWord|📤]]) 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|Module talk:Sidebar/Archive 6#Removing sidebar images as page image]])
 
@[[User:Izno|Izno]]: I've added <code>notpageimage</code> to the [[Template:Sidebar/sandbox|sandbox]] and [[Module:Sidebar/configuration/sandbox|its configuration]]. [[User:The RedBurn|The RedBurn]] <small>([[User Talk:The RedBurn|ϕ]])</small> 06:36, 30 August 2025 (UTC)
 
:@[[User:The RedBurn|The RedBurn]] Unfortunately, the class needs to be on the <code>[[File:</code> syntax and not on a container of that item.
:(NB make sure the ping is attempted in the same edit as you sign.) [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 16:53, 1 September 2025 (UTC)
 
== ARIA ==
 
{{edit request}}
 
Hi, per WIA-ARIA, can the parent {{tag|table|o}} HTML element with classes <code>sidebar sidebar-collapse nomobile nowraplinks</code> please get an ARIA role. Like the Mbox templates (see [[Module:Message box]], I was thinking <code>role="none"</code> 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 <code>role="navigation"</code>.
 
@[[User:Izno|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 <code>role="none"</code> and a boolean argument to switch this to <code>role="navigation"</code>?
 
(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 {{tag|ul|o}}, {{tag|li|o}}, 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...) <span style="color:#CD0000">[[User:Waddie96|waddie96]] ★ ([[User talk:Waddie96|talk]])</span> 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. [[User:Izno|Izno]] ([[User talk: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 <code>role="navigation"</code> to the parent {{tag|table|o}} 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 {{tag|nav|o}}) to accessibility technology.
::I guessed this, so please don't slate me:
::{{textdiff|<nowiki>:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)</nowiki>
|<nowiki>:css('width', args.width or nil)
:cssText(args.bodystyle or args.style)
:attr("role", "navigation")</nowiki>}}
::or is it <code>setAttribute("role", "navigation")</code>? I feel like the former.<span style="color:#CD0000">[[User:Waddie96|waddie96]] ★ ([[User talk:Waddie96|talk]])</span> 17:39, 1 September 2025 (UTC)
:::Or you can just say sync to the sandbox. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 19:13, 1 September 2025 (UTC)