-
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
Media & text block: Try to fix JavaScript warning #54965
Conversation
Flaky tests detected in b641bf4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6379337727
|
Size Change: +95 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Good catch, @carolinan! I think this code has been around for a while, and nobody noticed an error. Alternatively, you can also cast the
|
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.
Thanks for the PR, @carolinan!
I prefer the approach of casting to boolean
, mentioned in this comment. In other blocks, we often see examples of casting attributes that may be undefined
to boolean
.
Lets go with the smaller fix :) |
it will be faster to close this PR and add the fix in a new. I will not have to time today because I'm attending a contributor day :) |
What?
Adds
false
as the default value for the ImageFill block attribute in the Media & Text block.Closes #54963
Why?
The imageFill block attribute is a boolean but has no default value.
In WP 6.4 beta this caused a JavaScript warning in the block editor when the setting "Crop image to fill entire column" was enabled. See the issue linked above.
Testing Instructions
Create a new post or page.
Add a media & text block. Select or upload an image.
Enable the option "Crop image to fill entire column"
Confirm that there is no JavaScript warning about the value changing from undefined to a defined value, and that the crop setting continues to work.
Deactivate Gutenberg, add two media and text blocks, one with the crop option enabled, one without. Activate Gutenberg again and confirm that there are no block validation errors.