-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Block Editor: Prevent negative width values in Spacer block when used inside a row block #68845
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
Block Editor: Prevent negative width values in Spacer block when used inside a row block #68845
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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, @himanshupathak95!
The fix looks good, and I think we can simplify it further. Could you also rebase this branch on top of the latest trunk?
Thanks
@@ -188,6 +192,7 @@ function FlexControls( { | |||
} ); | |||
} } | |||
value={ flexSize } | |||
min={ minUnitValue } |
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.
min={ minUnitValue } | |
min={ 0 } |
Suggestion: We can just hardcode value here and there's no need to pass minUnitValue
. I cannot think of a case where negative height/width values should be allowed here.
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 thought behind not hardcoding was to provide maximum flexibility. Thanks for the simplification :)
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.
Some leftovers for the minUnitValue
prop remain. We should also remove those, as they no longer serve a purpose.
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.
Yes, @Mamaduka, I am on it.
f0d0c0e
to
2b6385e
Compare
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 follow-ups, @himanshupathak95!
… inside a row block (WordPress#68845) Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Fixes: #68847 (Point 1)
What?
Prevent negative width values in the Spacer block when used inside Row blocks.
Why?
Currently, when a Spacer block is placed in a Row block, it can accept negative width values, which is not ideal.
Testing Instructions
Screencast
Before
Screen.Recording.2025-01-23.at.13.00.11.mov
After
Screen.Recording.2025-01-23.at.12.59.23.mov