Opened 5 months ago
Last modified 3 months ago
#61723 new defect (bug)
Twenty Sixteen: Image Block Alignment Offset (Left/Right)
Reported by: | mrfoxtalbot | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch changes-requested |
Focuses: | javascript | Cc: |
Description
After the 6.6 updated, floated images in Twenty Sixteen are offset: margin-left: -40%;
Steps to reproduce
- Add a new post through this path: My Site → Posts → Add New
- Add texts with "Paragraph" block.
- Add an image with "Image" block.
- Resize the image, and change alignment to either right or left.
- Save and preview to see the issue on the live page or preview.
- What you expected to happen
- I will see the image alignment correctly on the live/preview page.
What happened
The image is slightly shifted to the left, causing text to overlap with the image when right-aligned, and creating a larger gap between the text and the image when left-aligned.
This was originally reported in https://github.com/Automattic/wp-calypso/issues/92833
Attachments (5)
Change History (13)
#1
@
5 months ago
- Keywords reporter-feedback added
Unfortunately, using these steps and the latest version of Twenty Sixteen, I am unable to replicate. I will share screenshots but my thoughts are there might be other steps or things that are at play here to consider. Once we have those we can progress knowing them.
#2
@
5 months ago
- Focuses javascript added
- Keywords needs-patch added; reporter-feedback removed
- Milestone changed from Awaiting Review to Future Release
- Version 6.6 deleted
The negative margin itself is part of an intentional design feature for full-width images and aligned blockquote
elements.
The bug with resized images requires a specific set of conditions to reproduce, and I was able to experience it with WordPress 6.5 and Twenty Sixteen 3.2 as well as WP 6.6.
- Place the Image block after enough content so that it would appear below the entry meta on large screens.
- Choose an image that is at least 840 pixels wide.
- Change the Width setting to resize the image, but keep the "Large" or "Full Size" Resolution setting.
The below entry meta script checks the width
attribute for the size, but the editor adjusts the image width in the style
attribute.
#3
@
5 months ago
The below-entry-meta
class can be added incorrectly whether the block has some alignment setting (left, right or center):
<div class="wp-block-image"> <figure class="alignleft size-large is-resized"> <img width="1024" height="512" class="wp-image-30 below-entry-meta" style="object-fit:cover;width:294px;height:auto" ... > <figcaption class="wp-element-caption below-entry-meta">caption</figcaption> </figure> </div>
or without alignment:
<figure class="wp-block-image size-large is-resized"> <img width="1024" height="512" class="wp-image-30 below-entry-meta" style="object-fit:cover;width:294px;height:auto" ... > <figcaption class="wp-element-caption below-entry-meta">caption</figcaption> </figure>
This ticket was mentioned in PR #7073 on WordPress/wordpress-develop by @umeshsinghin.
5 months ago
#4
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/61723
#5
@
5 months ago
- Keywords changes-requested added
I just added the word "incorrectly" in comment:3 because those are examples of how the below-entry-meta
class is wrong with the current functions.js
. The script needs to avoid adding the class when the style attribute sets a smaller size than the width
attribute.
#7
@
4 months ago
I am going to add testing keyword to this so we can ensure that happens. When testing please note the specific instructions as it needs those to recreate, thank you @sabernhardt.
#8
@
3 months ago
Another related issue caused by the "Overhanging Full-Size Image" feature is that the center alignment is ignored. When the user sets a center alignment to the image block, the image is aligned to the left regardless (see the attachment above)
Shouldn't the setting be respected and the image be centered in the middle?
This was raised initially here: https://github.com/Automattic/themes/issues/7336
Offset Image Floats in Twenty Sixteen