-
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 deprecation when width/height attribute is number #57063
Conversation
Size Change: +44 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 5620929. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7209809572
|
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.
Tested the change and it works as expected 👍
Thank you for the fix @t-hamano!
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.
Thank you for this fix 🙇🏻
…57063) # Conflicts: # test/integration/fixtures/blocks/core__image__deprecated-v3-add-align-wrapper.serialized.html # test/integration/fixtures/blocks/core__image__deprecated-v6-add-style-width-height.serialized.html
I just cherry-picked this PR to the 6.4/latest-fixes branch to get it included in the next release: c970b00 |
…57063) # Conflicts: # test/integration/fixtures/blocks/core__image__deprecated-v3-add-align-wrapper.serialized.html # test/integration/fixtures/blocks/core__image__deprecated-v6-add-style-width-height.serialized.html
Package Update includes fixes for: - Image Block: Enable image block to be selected correctly when clicked. - Reduce specificity of default Cover text color styles. - Image Block: Fix deprecation when width/height attribute is number. - Text selection: show CSS hack to Safari only. - SlotFill: Allow contextual SlotFillProviders. See: #5696 See: WordPress/gutenberg@bd6767b See: WordPress/gutenberg#56043 See: WordPress/gutenberg#56411 See: WordPress/gutenberg#57063 See: WordPress/gutenberg#57300 See: WordPress/gutenberg#56779 Props mikachan, wildworks, alexstine, poena, isabel_brison, andrewserong, czapla, andraganescu, joen, ellatrix, youknowriad, ntsekouras. Fixes #59943, #59943. git-svn-id: https://develop.svn.wordpress.org/trunk@57258 602fd350-edb4-49c9-b593-d223f7449a82
Package Update includes fixes for: - Image Block: Enable image block to be selected correctly when clicked. - Reduce specificity of default Cover text color styles. - Image Block: Fix deprecation when width/height attribute is number. - Text selection: show CSS hack to Safari only. - SlotFill: Allow contextual SlotFillProviders. See: WordPress/wordpress-develop#5696 See: WordPress/gutenberg@bd6767b See: WordPress/gutenberg#56043 See: WordPress/gutenberg#56411 See: WordPress/gutenberg#57063 See: WordPress/gutenberg#57300 See: WordPress/gutenberg#56779 Props mikachan, wildworks, alexstine, poena, isabel_brison, andrewserong, czapla, andraganescu, joen, ellatrix, youknowriad, ntsekouras. Fixes #59943, #59943. Built from https://develop.svn.wordpress.org/trunk@57258 git-svn-id: http://core.svn.wordpress.org/trunk@56764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Package Update includes fixes for: - Image Block: Enable image block to be selected correctly when clicked. - Reduce specificity of default Cover text color styles. - Image Block: Fix deprecation when width/height attribute is number. - Text selection: show CSS hack to Safari only. - SlotFill: Allow contextual SlotFillProviders. See: WordPress/wordpress-develop#5696 See: WordPress/gutenberg@bd6767b See: WordPress/gutenberg#56043 See: WordPress/gutenberg#56411 See: WordPress/gutenberg#57063 See: WordPress/gutenberg#57300 See: WordPress/gutenberg#56779 Props mikachan, wildworks, alexstine, poena, isabel_brison, andrewserong, czapla, andraganescu, joen, ellatrix, youknowriad, ntsekouras. Fixes #59943, #59943. Built from https://develop.svn.wordpress.org/trunk@57258 git-svn-id: https://core.svn.wordpress.org/trunk@56764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes #56916
What?
This PR fixes an issue where deprecation is not performed correctly and the block is broken when the image block's width/height attributes are number.
That is, it fixes the v6 deprecation that runs when updating from WordPress 6.2 to 6.3/6.4.
Why?
In #52286, the width/height attributes (not block attributes) of the
img
element are now output as inline styles of thefigure
element. This change has been backported to WP6.3.To that end, a v6 deprecation was added that outputs inline styles based on existing block attribute values. However, the block attribute value stored as a comment delimiter remains number, which causes the block validation to fail.
How?
In v6 migration, numbers are now explicitly converted to pixel strings. In this migration, the width/height block attributes should always be numbers, but just to be sure, I check whether they are numbers or not, and then convert them to pixel strings.
Testing Instructions