#48697 closed defect (bug) (fixed)
Twenty Nineteen - Linked Image Block Images Display Issue
Reported by: | JarretC | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch has-screenshots commit |
Focuses: | css | Cc: |
Description
The style.css stylesheet has the following code
@media only screen and (min-width: 768px) { .entry .entry-content .wp-block-image:not(.alignwide):not(.alignfull) > img { max-width: calc(8 * (100vw / 12) - 28px); } } @media only screen and (min-width: 1168px) { .entry .entry-content .wp-block-image:not(.alignwide):not(.alignfull) > img { max-width: calc(6 * (100vw / 12) - 28px); } }
Due to the fact that the > combinator specifies a direct child of the specified element, any images that are used in an image block and then linked somewhere do not adhere to the width set by the theme.
To replicate...
- Create an image block
- Add an image
- Create a link to that image
The above CSS only targets
<figure> <img /> </figure>
However, adding a link to the image causes this HTML
<figure> <a> <img /> </a> </figure>
Attached patch removes the > child selector to ensure that all images within the image block are matched.
Reported on forums here:
https://wordpress.org/support/topic/image-width-changes-when-you-insert-link-with-visual-editor/
Attachments (3)
Change History (8)
This ticket was mentioned in PR #2333 on WordPress/wordpress-develop by sabernhardt.
3 years ago
#1
#2
@
3 years ago
- Focuses css added
- Milestone changed from Awaiting Review to 6.0
Thanks for the report and the original patch!
r45605 added that max-width, and the SCSS comment explains that it does not belong on images that are aligned left, right or center. Those have a figure
in between the wp-block-image
class and the image, so the child selector did not affect them.
<div class="wp-block-image"> <figure class="aligncenter"> <img /> </figure> </div>
In addition to adjusting styles for linked images, the captions apparently need the max-width
to match the content width for proper centering. And in columns, the images need to go back to max-width: 100%
.
#3
@
3 years ago
- Keywords has-screenshots commit added
- Owner set to audrasjb
- Status changed from new to assigned
Self assigning for commit consideration.
3 years ago
#5
Committed in https://core.trac.wordpress.org/changeset/52927
max-width
of a linked image to the post content width.max-width
to the image captions.max-width
to 100% when inside column blocks.Trac ticket: https://core.trac.wordpress.org/ticket/48697