Template talk:Navbox

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Color accessibility issue in V*T*E links on standard navbox title color[edit]

I discovered that the wikipedia red link color on the standard navbox title color does not obey the WCAG 2.0 standards for text color contrast below 18pt. Not sure what to do about this. I started a discussion about this at WT:WikiProject Accessibility#Wikipedia red link on wikipedia standard navbox title violates WCAG 2.0, feel free to join in. —hike395 (talk) 07:33, 3 January 2018 (UTC)

Tracking old style borders[edit]

after changes to this module, the "old style" css borders no longer work as expected. The fix is to replace them with box-shadow borders like this. does anyone object to adding tracking to find these? I have put some code in the sandbox. Frietjes (talk) 19:03, 8 January 2018 (UTC)

This is above my head but I looked at the diff between the main and sandbox modules and it looks good. However, what is the pipe doing in:
args = getArgs(frame, {wrappers = {'Template:Navbox|subgroup', 'Template:Navbox'}})
I don't use Module:Arguments enough to know whether a pipe would do anything useful. I would have thought that each string in the wrappers table had to be the name of a template. Johnuniq (talk) 23:38, 8 January 2018 (UTC)
Johnuniq, thanks for spotting the error. I had been replacing 'navbox subgroup' with 'navbox|subgroup' and forgot to turn off the script before editing the module. now corrected. by the way, if you have time to figure out how to make Template:Navbox subgroup/sandbox work with the getArgs, that would be great. you can probably experiment with "Navbox subgroup" directly since the transclusion count is low. Frietjes (talk) 00:34, 9 January 2018 (UTC)
@Frietjes: What shows that it is not working? See test at sandbox2 (permalink). Johnuniq (talk) 02:13, 9 January 2018 (UTC)
Johnuniq, I added a comparison with the live version. basically, the only parameter being passed explicitly, the border, is not recognized. Frietjes (talk) 13:50, 9 January 2018 (UTC)
@Frietjes: So the problem is that Template:Navbox subgroup/sandbox invokes Module:Navbox/sandbox and passes a border parameter. The expected behavior is that the border parameter from the template would be merged with the parameters from the parent, that is, from the wikitext in User:Johnuniq/sandbox2, the reason that is not happening is due to the use of wrappers in the module:
args = getArgs(frame, {wrappers = {'Template:Navbox subgroup', 'Template:Navbox'}})
Edit the sandbox module and change the above line to:
args = getArgs(frame)
then paste User:Johnuniq/sandbox2 into the "preview page with this module" box and Show preview. The idea of Module:Arguments is to merge arguments from the invoking template and the parent wikitext, but that is usually unnecessary overhead, therefore wrappers can be used to specify the templates which do not pass parameters (they merely wrap the module) and which therefore do not need merging. I can't understand the documentation for Module:Arguments so experiment would be needed to determine what would happen if a border parameter was passed in the parent wikitext as well as from the template. Johnuniq (talk) 02:30, 10 January 2018 (UTC)
Johnuniq, yes, I had experimented before with removing the wrappers parameter, and found that it worked. however, I have no idea why it doesn't work with the wrappers parameter. looking at Module:Arguments it should be looping over the entries in the table of wrappers and passing them to the "matchesTitle" function? assuming that part is working, then there must be a logic mismatch between the "wrapper" and "no wrappers" branches of the code. Frietjes (talk) 15:59, 10 January 2018 (UTC)
after reading the documentation for Module:Arguments some more, I see that if it is a wrapper, then it won't parse the parent args? so, if that is the case, we definitely don't want "navbox subgroup" to be listed as a wrapper. another option would be to have a separate "subgroup" entry point into the module, but that seems a little excessive considering how few transclusions there are of "navbox subgroup" at the moment. Frietjes (talk) 16:03, 10 January 2018 (UTC)
@Frietjes: We discussed this in July 2017 here. I forget all about that, but I see that my local copy of Module:Navbox had some code to get border from the template. I don't know if I ever tried that out last August, but I put it into Module:Navbox/sandbox just now. Does that work?
Re "if it is a wrapper, then it won't parse the parent args?": Module:Args always gets the parent args (that is, the arguments from User:Johnuniq/sandbox2 in our example). There may be a way to turn that off so "always" may be a bit strong, but the cases I have seen always involve getting the parent args, the purpose of wrappers is to avoid the overhead of merging arguments from the template—if it is a wrapper, then an argument in the wikitext of the template definition will be ignored. If the template might have various arguments that should be merged, you would omit the template from wrappers; in the case we are considering, the only template parameter is border so my edit checks for that only. It should work! Johnuniq (talk) 02:48, 11 January 2018 (UTC)
Johnuniq, looks good, I have updated the main template. by the way, I hope I didn't completely mangle Module:Football manager history. immediately after I turned on the tracking, pages using that module started popping up in the "uses basic css borders" tracking category, so I changed the borders to use the 'box-shadow borders'. unfortunately, the box-shadow borders (see {{box-shadow border}}) are more complicated, but without them you don't get the visual separation between the groups/above/below etc. please let me know (or correct it) if I screwed it up. Frietjes (talk) 13:14, 11 January 2018 (UTC)
In case it's not obvious, all I did in writing Module:Football manager history was emulate what the old template did. What you have done with the border is way over my head. Re the changes to the module, they look good; in addiflist it might be better to use ipairs for consistency—that's how a list should be iterated. Also, it would be a little more efficient to have addifsubst which takes a long string rather than a table, it would replace (substitute) each occurrence of %1 with item using gsub. However, your code is good and I am just mentioning my thoughts for completeness. By the way, your script might be doing more than wanted: check diff which changed "Carson–Newman" to "Carson to Newman". I might look at it more another time. There were quite a few problems when I converted a zillion articles using the system to the syntax preferred by {{Football manager history}}. I could see the template might be useful in other cases but I was exhausted by then. Johnuniq (talk) 06:53, 12 January 2018 (UTC)
I just had a look at my contributions. It was actually 1377 templates, not articles, OMG. I think I used a Python script to do the major edit (example), then manually checked if it had worked. Johnuniq (talk) 06:59, 12 January 2018 (UTC)
Johnuniq, the six or so conversions to Template:Football manager history were done by hand using search-replace, so it's not too shocking that I screwed one up. in any event, those changes were reverted, so it's not an issue at this point. the bigger idea would be to take the simplified colouring syntax from that module and make it generic. and, even better would be to take the automatic link colouring code from Module:Team roster navbox as well. Frietjes (talk) 13:24, 12 January 2018 (UTC)
Johnuniq, I simplified my changes to Module:Football manager history as suggested. hopefully it looks better now. thank you. Frietjes (talk) 18:11, 12 January 2018 (UTC)
The module changes are great, thanks. Later I could help with your "bigger idea" if wanted, and if I could see some simple examples of what is meant. Johnuniq (talk) 01:25, 13 January 2018 (UTC)

Not wrapping bullets properly... What happened to {{·wrap}} and other similar templates?[edit]

There was a change made a number of years ago to line-break handling either as part of the Common CSS and / or somewhere else. I'm not sure if it was done intentionally or if it was overlooked, but as a result of these changes wrapping is not currently being handled correctly within many {{navbox}}es when they use {{hlist}}. See these examples of one section of the {{Wikipedia technical help}} template and note how the bullets between each item can sometimes start a newline when changing the width of the page, which is not desired:

Current (incorrectly wrapping) code:
Fixed code by avoiding the use of {{hlist}}:
What this code could look like if {{·wrap}} and its alias {{·w}} were never deleted:

{{Navbox | title = [[Help:Directory#Technical help|Wikipedia technical help]] | listclass = hlist | state = {{{state<includeonly>|{{{1|autocollapse}}}</includeonly>}}} | basestyle = text-align: center; | name = Wikipedia technical help | bodyclass=hlist

| above = '''Get personal technical help at [[Wikipedia:Teahouse|the Teahouse]], [[Wikipedia:Help desk|Help desk]], [[Wikipedia:Village pump (technical)|Village pump (technical)]], [[Help:Introduction to talk pages/1|talk pages]] or [[Wikipedia:IRC|IRC]].'''

| group3 = [[Wikitext]]

| list3 = {{nowrap begin}}[[Help:Wikitext|Wikitext main page]] ([[Help:Cheatsheet|Cheatsheet]]){{·w}} [[Help:Using colours|Colours use]]{{·w}} [[Help:Columns|Column]]s{{·w}} [[Wikipedia:Line-break handling|Line-break handling]]{{·w}} [[Help:List|Lists]]{{·w}} [[Help:Magic words|Magic words]] ([[Help:Magic words for beginners|For beginners]]{{·w}} [[Help:Conditional expressions|Conditional expressions]]{{·w}} [[Help:Switch parser function|Switch parser function]]{{·w}} [[Help:Time function|Time function]]){{·w}} [[Help:Redirect|Redirects]]{{·w}} [[Help:Section|Sections and TOCs]]{{·w}} [[Help:Table|Tables]] ([[Help:Introduction to tables with Wiki Markup/1|Introduction]]{{·w}} [[Help:Basic table markup|Basics]]{{·w}} [[Help:Conditional tables|Conditional tables]]{{·w}} [[Help:Sorting|Sorting]]{{·w}} [[Help:Collapsing|Collapsing]]{{·w}} [[Wikipedia:Advanced table formatting|Advanced table formatting]]){{nowrap end}}

| below = {{nowrap begin}}'''See also: [[:Category:Wikipedia information pages]]'''{{·w}} '''[[:Category:Wikipedia how-to]]'''<br>Further navigation at: [[Template:Wikipedia help pages|Help pages]] ([[Template:Administrators' guide|Administrators]]){{·w}} [[Template:Wikipedia template messages|Templates]]{{·w}} [[Template:Wikipedia referencing|Referencing]] ([[Template:Citation metadata navbox|Citation metadata]]){{·w}} [[Wikipedia:WikiProject Accessibility/Navigation menu|Accessibility]]{{·w}} [[Template:Botnav|Bots]]{{·w}} [[Wikipedia:User scripts/Navbox|User scripts]]{{·w}} [[Template:Wikipedia accounts|Accounts]]{{nowrap end}} }}

My (very limited) understanding of why this was done is that it had something to do with IE not rendering the line breaks properly with the old system. I realize this will need to be a larger discussion and for all I know that discussion could have already happened, but I don't know if or when as I haven't been as active on Wikipedia in the last 10 years or so. I would appreciate it if someone could point me in the right direction to read more about this. If it hasn't been properly discussed, where would be the best place to raise this issue? I see in the deletion discussion for {{·wrap}} that this issue was brought up but then quickly dismissed. Was it working properly back then and then has subsequently regressed?

Thanks so much for pointing me in the right direction. - PaulT+/C 21:15, 7 March 2018 (UTC)

@Psantora: hlist originally worked the same way as you expect. However, it was indeed discovered that IE sucks (and even possibly other versions of other browsers), and our then-CSS-guru Edokter (since-retired due to some drama in 2016) threw his hands up and said "no more" after some number of attempts to make that behavior stick in all browsers, this would have taken place in the history of Mediawiki:Common.css, though I cannot see a talk page discussion on the point from brief searching, so that may have occurred elsewhere. From memory, it may also have to do with hlist's increased use in sidebar templates, where space does not necessarily allow for dots, causing really unfortunate rendering (the dots extend out of the browser viewport causing a sideways scrollbar--bad behavior). --Izno (talk) 00:53, 8 March 2018 (UTC)
As for the previous templates (dot-w, and even nbsp-dot), those are entirely deprecated due to accessibility concerns. There is zero chance that those are allowed in the mainspace. --Izno (talk) 00:54, 8 March 2018 (UTC)
@Izno:Now that you mention it, I do remember a period of time a number of years ago where there were a bunch of display problems with horizontal scrolling all over Wikipedia. Given that this isn't going to be fixed in hlist, is there some reason the old templates can't be restored? This is the first I've heard of accessibility concerns with them, unless you mean approachable in terms of editing the MediaWiki code? If you have any idea where that discussion happened I'd like to read it before going to WP:DRV.
What is {{nbsp-dot}}/{{nbsp·}}? — Preceding unsigned comment added by Psantora (talkcontribs)
@Psantora: Yes, they will not be restored because WP:Accessibility is required. The old templates are not accessible to users who have bad vision. What looks to you and I like a list with bullets between them is sounded as "A bullet B bullet C bullet D", and which most bad-eyesight programs do not allow skipping of, whereas the current format would sound something like "list of 8 items. do you want to hear/skip the items?" in those programs. "What is {{nbsp-dot}}/{{nbsp·}}?" Those are how the templates you are talking about are implemented (give or take)--"nonbreaking space, dot" or in some cases "span with nowrap applied, with internal item, space, and dot". Coincidentally, those basically have some of the same issues as the hlist class (regarding the sidebar and squished navbox problem). DRV will not see these templates undeleted, I can say with some great level of certainty. --Izno (talk) 19:20, 9 March 2018 (UTC)
As for whether hlist will be fixed, I do not know if it will be or won't be. Our support for old versions of Internet Explorer has dwindled over the past several years as Microsoft has turned to deprecating or dropping support for old versions as well (only IE11 is actively supported). The compatibility support provided by the WMF in MediaWiki is IE11, with basic "make sure the entire page doesn't explode" support to versions greater than IE6. So, I think there's some opportunity to broach the topic of nowrap bullets on Mediawiki talk:Common.css--you might invite readers of WP:VPT when you open that discussion, because the CSS talk page is rather quiet these days. It doesn't need to be a long post--just a "hey, maybe we should look at this again". --Izno (talk) 19:30, 9 March 2018 (UTC)
Thanks for the information. It was super helpful. I will consider bringing the discussion up there (and pinging a link to VPT). I really appreciate it! - PaulT+/C 03:57, 11 March 2018 (UTC)

Image doesn't show up[edit]

In the {{{image}}} parameter, I have specified my image the same way I did on another page. And if I put the same image below the Navbox, it also shows up. I also have a {{{list1}}}. Any ideas why the image is not showing? Lithimlin (talk) 19:09, 17 April 2018 (UTC)

In order to trouble-shoot this issue we'll need to see the usage. Where are you testing this? Primefac (talk) 19:27, 17 April 2018 (UTC)
I'm testing this in a wiki I'm helping to put together right now. I'm kind of misusing the {{navbox}} here, but it was the only thing I found so far that can be used as an {{infobox}} that spans across the top of a page instead of being on the top right of it. Lithimlin (talk) 19:40, 17 April 2018 (UTC)