Description
openedon Dec 7, 2023
Description
When adding a new gallery block instance and not changing the columns, the container element includes the class "columns-default", but does not include a class for the number of columns that the default is set to (for example, "columns-3"). If you switch the columns manually to a number other than the default (3) and then switch back to the 3. The instance will now be output with the class "columns-3" but will not include "columns-default".
Arguably the initial instance should display "columns-default" and "columns-3" to make styling easier, and to be of use to and custom JavaScript that needs to determine the number of columns the gallery block is intended to display. Also, after the column count being changed to a value other than 3 and then set to 3 again, the class "columns-default" should probably be added back.
Step-by-step reproduction instructions
- Add an instance of the gallery block to a page or post.
- Add an image.
- Leave the columns count the same (3 in a clean install).
- Publish the page or post.
- View the page.
- Inspect the page's HTML structure.
- The wp-block-gallery instance will include the class "columns-default" but not the class "columns-3"
- Edit the page/post
- Change the columns to a value other than the default.
- Save the page/post.
- Change the columns back to the default of 3.
- Save the page or post.
- Inspect the page's HTML structure.
-
- The wp-block-gallery instance will include the class "columns-3" but not the class "columns-default".
Screenshots, screen recording, code snippet
No response
Environment info
Wordpress: 6.4.2
Gutenberg: 16.2-16.7 (as per https://developer.wordpress.org/block-editor/contributors/versions-in-wordpress/)
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes