Template talk:Gallery
Add topic| Template:Gallery is indefinitely protected from editing as it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify a template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
| This is the talk page for discussing improvements to the Gallery template. |
|
| Archives: 1, 2Auto-archiving period: 3 months |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
| ||||||||
Vertical alignment
[edit]Is is possible to vertically align images? PhotographyEdits (talk) 11:00, 9 March 2025 (UTC)
Align footer left
[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)
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)
"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)
Edit request 11 November 2026
[edit]| It is requested that an edit be made to the template-protected template at Template:Gallery. (edit · history · last · links · sandbox · edit sandbox · sandbox history · sandbox last edit · sandbox diff · test cases · transclusion count · protection log) This template must be followed by a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately. There is a low backlog of edit requests. Currently, there are 5 pages with edit requests waiting in the queue.
Edit requests to template-protected pages should only be used for edits that are either uncontroversial or supported by consensus. If the proposed edit might be controversial, discuss it on the protected page's talk page before using this template. Consider making changes first to the template's sandbox and test them thoroughly here before submitting an edit request. To request that a page be protected or unprotected, make a protection request. When the request has been completed or denied, please add the |
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('mw-collapsible')
:addClass('mw-collapsed') |
Line 216:
| − | :addClass('main') | + | :addClass('main'):addClass('mw-collapsible-content') |
JaneBuzJane (talk) 18:35, 11 November 2026 (UTC)
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)- 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)
Diff:
Line 107:
| − | : | + | :addClass('mw-collapsible')
:addClass(args.state == 'collapsed' and 'mw-collapsed' or nil) |
Line 216:
| − | :addClass('main') | + | :addClass('main'):addClass('mw-collapsible-content') |