-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image block: fix image size at wide and full width #53184
Conversation
Size Change: -16 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 3849684. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5716536317
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inherit
for the resize wrapper looks like it exists in CSS too, so I think this should be good. I've tried a bunch of things to break it and everything seems fine.
Thanks for the review, @ajlende! I would like to add a backport label as this PR solves a newly encountered bug in WP6.3. |
I just cherry-picked this PR to the update/second-round-6-3-rc3 branch to get it included in the next release: 6903bb1 |
* Top toolbar: Fix issues with save button overlap, and plugin buttons (#53101) * Shorten the width of the top toolbar overlay and make doc title smaller. * Add a scrim and a margin to handle plugin buttons better. * Remove block tools back compat component schedule for deprecated in 6.3 (#53115) * Removes usage of BlockToolsBackCompat * Remove unwanted BlockTools from Nav sidebar * Footnotes/RichText: fix getRichTextValues for deeply nested blocks (#53034) * Defer to preceding handlers in command palette keyboard shortcut (#53001) * Image block: fix image size at wide and full width (#53184) * Fix regression with Edit site Navigate regions (#52940) * Make the navigabel region wrap the inert sidebar. * Adjust animation. * Fix not expanding pattern in page editor (#53169) --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Footnotes: fix published preview (#53072) * Footnotes: fix published preview * remove var dump * Fix php lint * PHP lint * Address feedback * Add e2e test * Footnotes: disable for synced patterns and prevent duplication for pages in site editor (#53003) * Initial commit: - Prevent footnote creation withing core/block - Only insert a footnote if one isn't found in the entity block list * Try grabbing controlled blocks from parent post content block * Cache `selectedClientId` Get hasParentCoreBlocks using separate useSelect call. * Rename hasParentCoreBlocks to isBlockWithinPattern Add comments * Removing while loop since we're already fetching the post content parent in the `getBlockParentsByBlockName` call above * Reinstating while loop because it can deal with nested blocks --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Footnotes: add missing _ in revision field filter (#53135) * Footnotes: add missing _ in revision field filter * Use correct hook name * Revert prefixing callback names * don't display BlockContextualToolbar at all in contentonly locking (#53110) * Render the footer conditionally in the global styles sidebar component so that any side effects from the footer wrapper are not rendered, e.g., styles and what not (#53204) Ensure that the precise bottom margin persists if the footer isn't rendered * Pattern: Add getBlockRootClientId call (#53206) --------- Co-authored-by: Joen A <1204802+jasmussen@users.noreply.github.com> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Mitchell Austin <mr.fye@oneandthesame.net> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Andrea Fercia <a.fercia@gmail.com> Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info>
Thanks for this needed improvement! I've found a little bug though: it does not work when custom image aspect ratio is set. To reproduce the issue:
The issue here is that there in If possible, the issue could be fixed simply by changing the inline style to: object-fit: cover;
aspect-ratio: 1000/200; Removing CSS for |
@webmandesign There are merged PRs that also hide the aspect control and also clear its attributes when the image is changed to wide/full align.
These pull requests are labeled as being backported to minor releases. |
@t-hamano Thanks for the info. I've commented on those tickets as I really find aspect ratio setup useful for wide and full aligned images too. |
+1 |
Fixes #53173
What?
This PR fixes a problem with images not being properly widened when wide or full width is set in the image block.
Why?
When the image block is wide or full width, width:100% should be applied to the
img
element as seen in this style.gutenberg/packages/block-library/src/image/style.scss
Lines 30 to 34 in 16f95a8
However, if the image element has neither width, height, nor aspect ratio, the width and height properties of the
img
element will beinherit
. As a result, I believe the width and height are implicitlyauto
, and the intended style is not applied.How?
Changed from
inherited
toundefined
. This should apply the appropriate style depending on the context of the image size.Testing Instructions
Note: I don't think it is intended that the width and height controls appear when wide or full width is used. I'm attempting to fix this issue in #53181.
Screenshots or screencast
443a880ab1b4a1d0690652bfbc4427d7.mp4