-
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
components: Add baseline validation to NumberControl #33291
components: Add baseline validation to NumberControl #33291
Comments
To pick up from #33285 (comment):
I know I've wondered about this very same thing. I suppose that |
I wonder if we should also make it more explicit that the value that is passed to the It's quite easy to forget that you should use gutenberg/packages/block-library/src/query/edit/query-toolbar.js Lines 64 to 75 in bbaeea2
gutenberg/packages/block-library/src/query/edit/query-toolbar.js Lines 88 to 97 in bbaeea2
gutenberg/packages/block-library/src/query/edit/query-toolbar.js Lines 115 to 120 in bbaeea2
Loom video to explain in a bit more detail: https://www.loom.com/share/c7cf93b582fa4350b8562242adfa9133 One suggested solution could be to pass values as both string and number to the |
Opened a tentative fix for this in #39186
Re. this suggestion, I made a note and I'm going to consider it when I'll resume the work on refactoring |
What problem does this address?
It's currently possible to input invalid values into the
NumberControl
: #33285To prevent this, you currently have to manage that in the
onChange
you pass. But we should be able to introspect into themin
andmax
values at minimum to create a generic validation function which prevents invalid values from being entered.What is your proposed solution?
Using the
min
andmax
props, verify that the input value is between those numbers, inclusive of both (to match the HTML API).The text was updated successfully, but these errors were encountered: