Template talk:Portal bar

Page contents not supported in other languages.
Source: Wikipedia, the free encyclopedia.
portals on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks
.
Template This template does not require a rating on the project's quality scale.
List of Portals

noviewer class so Media Viewer skip Portal Bar's images

I noticed that when using the Media Viewer to browse an article's images (e.g. those in Charlize Theron#See also) that the images in the Portal bar appear. This seems highly undesirable. There is a special class ("noviewer") that can used to have Media Viewer skip images, see Wikipedia talk:Media Viewer#Some images need to be excluded). Seems like a good idea for this template to use it. Jason Quinn (talk) 22:13, 16 January 2015 (UTC)[reply]

At a quick glance, I'm not sure how to add that class. (Sorry, I'm not much of a coder.) Tell me precisely what you want added and where and I'll do it when I have time. Alternatively, if you can do it yourself, go for it. – Maky « talk » 23:01, 16 January 2015 (UTC)[reply]
 Donehike395 (talk) 14:55, 20 December 2021 (UTC)[reply]

Version without Module:Navbox

This template currently outputs (in most cases) a <table> inside a <table>, when a tableless layout can achieve the same appearance. The template started using Template:Navbox and its nested tables with this diff, but I'm not sure why. I put a simplified version in the module sandbox (see testcases). Does this look okay? Matt Fitzpatrick (talk) 11:07, 18 June 2016 (UTC)[reply]

Edit requested

Changes

  • wraps list in a navigation region labeled "Portals", instead of nested single-cell tables
    • reduces HTML output about 200 bytes
    • provides accessibility context (WAVE report on testcases)
    • should reduce browser load (nested tables are slow)
  • removes margins from list
    • list is no longer horizontally and vertically off center

Incorporates feedback from

WT:WCAG#Module:Portal bar
. Thanks again to Redrose64 for pointing out that some of these images cannot be unlinked.

Matt Fitzpatrick (talk) 21:52, 28 June 2016 (UTC)[reply]

Added bonus, I just noticed the MediaViewer problem reported above in 2015 by Jason Quinn. This edit accidentally fixes that. The navigation region's "metadata" class keeps the images from being cycled in MediaViewer. Matt Fitzpatrick (talk) 22:17, 28 June 2016 (UTC)[reply]
@Matt Fitzpatrick: Done. Looked at this for a while. Code looks more lightweight here. And yeah, not sure why Navbox was needed. I think many folks support less tables in general. The new "aria-label Portals" looks okay to me, and bolding the entire thing as you've done doesn't seem to be a problem. Cheers, — Andy W. (talk ·ctb) 07:45, 29 June 2016 (UTC)[reply]
  • @Matt Fitzpatrick and Andy M. Wang, this edit appears to have introduced a 1em top margin for the portal bar, which makes the bar look strange when it was designed to run flush against the nav boxes at the bottom of the page. Please revert and we can discuss as necessary (ping me if so) czar 10:24, 13 July 2016 (UTC)[reply]
I rolled back Module:Portal bar/sandbox to the previous version, and added a new test at Template:Portal bar/testcases. Looks like the new ("main") version isn't getting the "table.navbox + table.navbox { margin-top: -1px; }" from MediaWiki:Common.css that the old ("sandbox") version did. I'll have to do some user CSS testing to make sure, but I have a hunch adding class="navbox" back to the portal bar, then adjusting the CSS to work with any element might work. Matt Fitzpatrick (talk) 11:11, 13 July 2016 (UTC)[reply]
Too close to bedtime to test this properly, but my first thought was readding the navbox class to bordered portal bars (Special:Diff/727480237/729612900), and editing Common.css to allow non-table elements to be navboxes (Old revision of User:Matt_Fitzpatrick/common.css). Will of course need wider notice, and careful testing of all things navbox related. I don't see at first glance any style declarations the table.navbox selector overrides that .navbox by itself wouldn't, though. Matt Fitzpatrick (talk) 12:13, 13 July 2016 (UTC)[reply]
@
Czar: Undid. Matt, I'm assuming you would be able to handle this. (I'm attempting to take a bit of a semi-wikibreak right now) — Andy W. (talk ·ctb) 16:01, 13 July 2016 (UTC)[reply
]
I'm putting up an edit request for MediaWiki:Common.css shortly. Old revision of User:Matt Fitzpatrick/common.css summarizes the edit request. The new CSS should resolve visual discrepancies in Template:Portal bar/testcases, but should not affect any part of Template:Navbox/testcases. Please let me know if you notice anything's gone wrong. Matt Fitzpatrick (talk) 23:13, 14 July 2016 (UTC)[reply]

Border

Why there is no border around images when compared to {{portal}}? Borders are defined in subpages, for example Module:Portal/images/j contains ["japan"] = "Flag of Japan.svg|border|link=|alt=", but display for {{portal|Japan}} (right) and {{portal bar|Japan}} (below) is different when we are looking for border:

Also, |link=|alt= could be moved to main module page(s) rather than being defined for each entry.--Obsuser (talk) 16:01, 4 May 2017 (UTC)[reply]

I don't think a border surrounding each image would improve the bar's appearance. I think would add unnecessary clutter. -- Michael Bednarek (talk) 01:44, 5 May 2017 (UTC)[reply]
Not every, but those that have [""] = "|border",. --Obsuser (talk) 17:16, 7 May 2017 (UTC)[reply]

Design

Hi,

I propose to edit this template to add a better design. In the French equivalent template fr:Modèle:Portail, the size of the text and the width of the space taken by the text adapts to the number of portals added. The problem here is that if five portals are entered, their names are all squeezed in the smae space as one or two portals. This is a portal promotion measure.

--Railfan01 (talk) 07:28, 12 May 2018 (UTC)[reply]

 Done (see below) — hike395 (talk) 14:57, 20 December 2021 (UTC)[reply]

Proposed change to template

I propose making two changes to the template (via Module:Portal bar):

  1. Add "nomobile" class to the portal bar, to make it not display on mobile WP. This would make it consistent with other navboxes that contain internal links at the bottom of articles.
  2. Only use the word "portal" once, at the beginning of the bar, rather than repeating "portal" for every link. This would make the template more compact, and more consistent with Template:Subject bar.

I've coded up these changes in Module:Portal bar/sandbox and Module:Portal bar/sandbox/styles.css. To demonstrate the proposal, here is a before/after:

Current
Proposed

You can see other examples at Template:Portal bar/testcases (the sandbox version has the proposed change).

What do other editors think of the proposed change? Suggestions to make the template better are more than welcome! — hike395 (talk) 13:39, 5 December 2021 (UTC)[reply]

I think the more compact design is an improvement, as is the slightly reduced icon size. -- Michael Bednarek (talk) 14:47, 11 December 2021 (UTC)[reply]
The text alignment in the Proposed bar doesn't look right, it seems as if the word Portals is middle aligned to its cell and the word Czech Republic is slightly higher (as are the other text labels).
Not repeating the word portal seems like a good idea, I'd want to check with non-English language readers to make sure it doesn't have any weird unintended consequences but it should probably work. -- 109.78.202.228 (talk) 20:49, 11 December 2021 (UTC)[reply]
I see (Chrome, Firefox) a slight misalignment the other way: the word "Portals:" seems a little bit higher than the icons and portal names. -- Michael Bednarek (talk) 02:04, 12 December 2021 (UTC)[reply]
I'd almost forgotten I'd switched to using Edge (mostly), I'm surprised that there would be any rendering differences from Chrome but
WP:OVERLINK I tend to think repeating very similar links all over the place, like in a portal box or portal bar, is a waste of time, mostly harmless but pointless.) -- 109.78.202.157 (talk) 05:50, 12 December 2021 (UTC)[reply
]

@Michael Bednarek and 109.78.202.157: I've reimplemented the layout using CSS Flexbox. I've attempted to make the baselines of all of the text strings line up vertically. Does this look good to you? (see above). — hike395 (talk) 17:39, 17 December 2021 (UTC)[reply]

As I wrote before, I think the changes are an improvement, and I can't see any alignment issues now. -- Michael Bednarek (talk) 03:29, 18 December 2021 (UTC)[reply]
 Done Thanks for checking! Upgraded the main template now. — hike395 (talk) 07:56, 18 December 2021 (UTC)[reply]

@Hike395, Michael Bednarek, and 109.78.202.157: Pardon me—I only just discovered the change. I'd prefer it if the content was still center-aligned within the bar, rather than left-aligned as it is now. It looks odd in the browser window of my (very wide) desktop display (the content of the above examples takes up less than a third of the bar). —DocWatson42 (talk) 06:20, 19 December 2021 (UTC)[reply]

@DocWatson42: Thanks for letting me know. You're right that I was optimizing for the case of smaller screens, which are more common nowadays. If you shrink your window horizontally, you can see how the bar responds to smaller screens. I also made Template:Subject bar call Module:Portal bar, and there were 20,000+ articles where a previous version of portal bar was left-aligned.
You're welcome. ^_^ —DocWatson42 (talk) 07:03, 19 December 2021 (UTC)[reply]
I can try and make a center-aligned version in the Sandbox (I'm still a newbie at modern CSS, so it might take me a number of attempts). In the meanwhile, it would be good to come to a consensus about left- versus center-aligned. Maybe left-aligned for small screens and centered for big ones? I like the left-alignment for small screens. I hope other editors will chime in. — hike395 (talk) 06:47, 19 December 2021 (UTC)[reply]
Left-alignment shouldn't matter for smaller windows, as the content compresses over to the left anyway (and then down when the window becomes narrow enough. I took Mr. Bednarek's advice and checked the above examples again.). —DocWatson42 (talk) 07:03, 19 December 2021 (UTC)[reply]
It turns out centering for large screens was quite easy (thanks to justify-content in CSS Flexbox). There's a working version you can look at in Template:Portal bar/testcases: the sandbox version has the centering for screens >768px across. I agree with Doc that this looks better. Any other comments or suggestions? — hike395 (talk) 07:17, 19 December 2021 (UTC)[reply]
Later: figured out centering on the small-screen version, too. That's now live in the sandbox. @DocWatson42 and Michael Bednarek: what do you think? — hike395 (talk) 07:59, 19 December 2021 (UTC)[reply]
Fine. I suppose having the content centred is a less severe change from the old format, so that shouldn't ruffle too many feathers. -- Michael Bednarek (talk) 10:42, 19 December 2021 (UTC)[reply]
 Done I promoted the sandbox CSS file to main. — hike395 (talk) 14:29, 19 December 2021 (UTC)[reply]
@Hike395: I'm sorry I missed this, though I'm replying because I've seen the results, which look good. You've (apparently) even fixed another problem—when portal bars were adjacent to Authority control templates there used to be a space between them, which I no longer see. —DocWatson42 (talk) 04:37, 22 December 2021 (UTC)[reply]
Yes, both {{Portal bar}} and {{Sister bar}} will now abut to all navboxes, and to each other. Let me know if you see any other odd spacing issues with them. — hike395 (talk) 05:32, 22 December 2021 (UTC)[reply]

Display on mobile?

On Iran, I converted an instance of {{Portal}} to {{Portal bar}} (via {{Subject bar}}), and Moxy objected, because {{Portal bar}} did not display on mobile. In response to their feedback, I've turned mobile display back on for {{Portal bar}}.

Is there a consensus for whether {{Portal bar}} should display on mobile? What do other editors think? — hike395 (talk) 14:43, 20 December 2021 (UTC)[reply]

@Hike395: I'd like it. IMHO all content should be displayed in mobile mode (e.g. navbars, which are also currently invisible). —DocWatson42 (talk) 04:37, 22 December 2021 (UTC)[reply]
I gather that the mobile display for {{Portal}} just got turned on, too, so that seems to be the trend. — hike395 (talk) 05:29, 22 December 2021 (UTC)[reply]

"Template:Prb" listed at Redirects for discussion

An editor has identified a potential problem with the redirect Template:Prb and has thus listed it for discussion. This discussion will occur at Wikipedia:Redirects for discussion/Log/2022 January 5#Template:Prb until a consensus is reached, and readers of this page are welcome to contribute to the discussion. MB 15:38, 5 January 2022 (UTC)[reply]

Adjacent navboxes confusion

The Charles III footer looked like this this morning:

This seems very easy to misread as saying that those fifteen links (Monarchy, Royalty, United Kingdom...) are the "related article" links that Wikipedia is offering the reader. (I moved the portal bar inside the navboxes collection in response to this issue, but I don't know if that's an appropriate fix.)

There's a similar example at Template:Portal_bar/testcases#Adjacent_navboxes:

There clearly isn't a consensus for the narrower box, so I've reverted to status quo ante.
@Krisgabwoosh: If we turn {{Portal bar}} into a navbox, it will not get displayed on mobile. The current consensus is that Portal links should appear on mobile. If I understand correctly, the filter inside of MediaWiki is on the "navbox" class itself. We would have to copy the entire navbox CSS class into another class, and then maintain the two to be identical. That sounds like a lot of maintenance.
From this discussion, I don't think there's an easy visual method that distinguishes the portal box from the previous navbox and is acceptable to many editors. I will take Bahnfrend's advice and start a discussion to change
MOS:ORDER
. I will ping everyone on this discussion over there.
hike395 (talk) 15:43, 18 September 2022 (UTC)[reply]

Discussion of where to place this template

A discussion of where to place {{

WT:MOSLAYOUT. Please feel free to join the discussion! — hike395 (talk) 19:41, 18 September 2022 (UTC)[reply
]