[wp-trac] [WordPress Trac] #60155: Gallery Block issue with aligning individual images (was: Bundled Themes: Gallery Block image alignment issue)
WordPress Trac
noreply at wordpress.org
Wed Jan 10 05:34:32 UTC 2024
#60155: Gallery Block issue with aligning individual images
------------------------------------+------------------------------
Reporter: pranitdugad | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: minor | Resolution:
Keywords: has-testing-info close | Focuses:
------------------------------------+------------------------------
Changes (by sabernhardt):
* keywords: has-testing-info needs-patch => has-testing-info close
* component: Bundled Theme => Editor
Comment:
This is not a bug to fix in each theme. If it should change, the report
would belong on the
[https://github.com/WordPress/gutenberg/issues/new/choose Gutenberg
repository].
Gallery block styles define the images' layout, but the markup for an
aligned image block is different for classic themes (such as Twenty Ten to
Twenty Twenty-One) than for block themes (such as Twenty Twenty-Two to
Twenty Twenty-Four). When an image block has a special alignment in
classic themes, the block assigns the `.wp-block-image` element to a `div`
and set the alignment class on a `figure` within the `div` instead of
having only the `figure` (which has all the classes). Meanwhile, the
[https://github.com/WordPress/gutenberg/blob/trunk/packages/block-
library/src/gallery/style.scss block styles] use `figure.wp-block-image`
for any theme.
{{{
<figure class="wp-block-image size-large">
<img src="image.jpg" alt="">
<figcaption class="wp-element-caption">no alignment</figcaption>
</figure>
<div class="wp-block-image">
<figure class="aligncenter size-large">
<img src="image.jpg" alt="">
<figcaption class="wp-element-caption">centered image in a classic
theme</figcaption>
</figure>
</div>
}}}
I do not understand why the markup needed to be different, and trying to
align an Image block inside a Gallery can have unexpected results, but it
may be best to leave it unchanged. I can even think of one desirable
situation where setting one image to center alignment can make that image
full width, with smaller images around it in two or three columns.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60155#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list