-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Cover block: Update placeholder minHeight style to support non-px units #35614
Cover block: Update placeholder minHeight style to support non-px units #35614
Conversation
CC: @ramonjd and @jasmussen 🙂 |
Size Change: -14 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
✅ Non-px units like em and rem should work correctly in the Cover block's placeholder state.
✅ Also check that the addition of decimal / floating point values doesn't cause any issues.
✅ Check that dragging the ResizableCover control still switches the unit to px as expected.
Thanks a lot for nabbing this one @andrewserong
Checked in Block and Site Editors. 👍
Values saved as expected on frontend. 👍
LGTM 🚢
⭐ |
Description
Following on from #35068, this small PR ensures that the placeholder minimum height styles supports non-px units. Currently, the minimum height value is treated as a
px
value when applied to the placeholder's height, irrespective of the unit selected.At the same time, for consistency with non-px units, the update logic is changed to use
parseFloat
instead ofparseInt
(to support decimal values in units likeem
,rem
,vw
,vh
), and the hard-codedstep="1"
is removed to also support the fractional default step values for non-px units.How has this been tested?
In the editor, add a Cover block. In its placeholder state, go to update the minimum height of the cover, and switch to a non-px unit like
em
. As you increase the number, note that before this PR, the value in the editor is treated aspx
. The real non-px value is still being correctly saved to the post content.With this PR applied, note that non-px units like
em
andrem
should work correctly in the Cover block's placeholder state. Also check that the addition of decimal / floating point values doesn't cause any issues.Check that dragging the ResizableCover control still switches the unit to
px
as expected.Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).