Jump to content

Template talk:Gallery

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia

Vertical alignment

[edit]

Is is possible to vertically align images? PhotographyEdits (talk) 11:00, 9 March 2025 (UTC)Reply

[edit]

I feel like it's weird and arbitrary that the footer is aligned right by default. It just makes the footer unsuitable for long text that wraps to the next line. Should there be an option that lets you change the alignment setting of the footer (right, center, left)? Nrco0e (talk • contribs) 06:39, 11 September 2025 (UTC)Reply

Why do we support packed-hover?

[edit]

I recently told @Crisco 1492 in WP:Featured article candidates/George F. Durand/archive1 to remove a hover directive because it is contraindicated by MOS:NOHOVER for various accessability reasons. Digging a little deeper, I see that this is supported by {{Gallery}} and that Help:Gallery tag even encourages it, saying that it "degrades gracefully on screen readers". So what's the real story here? Is packed-hover legit or not? RoySmith (talk) 19:03, 18 June 2026 (UTC)Reply

"State" parameter for collapsing does not work due to incorrect classes

[edit]

The module adds the class "collapsible" instead of "mw-collapsible" and "mw-collapsed," which means that the State parameter for setting the initial state of collapsed vs. expanded in the template does not work.

Suggest editing line 107 of the module to add the classes "mw-collapsible" and "mw-collapsed" as noted, and editing line 216 to add the class "mw-collapsible-content" so that if the Title parameter is present, then it is shown uncollapsed (with the images being the collapsed content) for accessibility. - JaneBuzJane (talk) 19:03, 28 August 2026 (UTC)Reply

Edit request 11 November 2026

[edit]

Description of suggested change: The module which powers this template adds the class "collapsible" instead of "mw-collapsible" and "mw-collapsed," which means that the State parameter for setting the initial state of collapsed vs. expanded in the template does not work (view test case). Suggest editing line 107 of the module to add the classes "mw-collapsible" and "mw-collapsed" as noted, and editing line 216 to add the class "mw-collapsible-content" so that if the Title parameter is present, then it is shown uncollapsed (with the images being the collapsed content) for accessibility.

I placed a comment on the talk page ~2 months ago but it has not received further discussion; I have made this edit on Miraheze's import of this module/template and it functions as expected (view sandbox).


Diff:

Line 107:

−
:addClass('collapsible')
+
:addClass('mw-collapsible') :addClass('mw-collapsed')

Line 216:

−
:addClass('main')
+
:addClass('main'):addClass('mw-collapsible-content')

JaneBuzJane (talk) 18:35, 11 November 2026 (UTC)Reply

 Not done. Next time, please put your code in the actual module sandbox so that the testcases page shows your code at work. I believe that I have adjusted the sandbox to your specifications, and it doesn't work. Any value of |state= leads to the gallery being collapsed. Please adjust the sandbox and make sure the testcases are working, then reactivate this edit request by changing "yes" to "no". – Jonesey95 (talk) 16:58, 13 November 2026 (UTC)Reply
Thanks Jonesey95, this is my first time suggesting an edit to a protected module so I appreciate the clear instruction on the proper procedure going forward. There was a gap in my test cases - I have made an updated edit to the Module sandbox and purged the Template test case page, which now correctly only collapses the gallery when "collapsed" is entered for the state parameter. I am including the updated diffs below, and these align with the current module's sandbox code. I have also updated the edit request to "no" instead of "yes." - JaneBuzJane (talk) 18:08, 13 November 2026 (UTC)Reply

Diff:

Line 107:

−
:addClass('collapsible')
+
:addClass('mw-collapsible') :addClass(args.state == 'collapsed' and 'mw-collapsed' or nil)

Line 216:

−
:addClass('main')
+
:addClass('main'):addClass('mw-collapsible-content')