-
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
Disallow setting grid block rows/columns to zero #65217
Conversation
@@ -74,7 +74,8 @@ export default { | |||
// In the experiment we want to also show column control in Auto mode, and | |||
// the minimum width control in Manual mode. | |||
const showColumnsControl = | |||
window.__experimentalEnableGridInteractivity || layout?.columnCount; | |||
window.__experimentalEnableGridInteractivity || | |||
!! layout?.columnCount; |
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.
This is what was incorrectly causing 0
to be rendered
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. |
Size Change: +9 B (0%) Total Size: 1.77 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.
Nice simple fix, this is testing well for me and makes sense that you can't set 0
columns in the UI. Folks can still switch back to Auto mode manually via the toggle, so it doesn't feel like an issue to me if people can no longer set 0
manually via the input field to toggle back to Auto — I doubt anyone would really reach to do that anyway.
LGTM! 🚀
Thanks for the quick fix! |
What?
Fixes #65201, by ensuring
0
isn't incorrectly output and then further not allowing a zero value for grid or row counts.Why?
IMO, a value of zero doesn't really make sense for grid block columns or rows, I'm not sure what purpose it would have, so I've added some code to disallow it. This also ensures the UI doesn't surprisingly switch between Manual and Auto without the user explicitly setting it.
How?
onChange
to prevent0
from being typed in.Testing Instructions
Screenshots or screencast
Before
After