Repository navigation
fix(blocks): accept in-range decimals in number inputs - #5133
justincavery wants to merge 3 commits into
Conversation
HTML number inputs use a default step of one from the minimum. Let number_input accept in-range decimal values so browser validation allows Block Kit forms to dispatch form_submit.
🦋 Changeset detectedLatest commit: ecbfdf9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
The approach is right: step="any" removes the browser's default step of 1 on number_input while keeping native min/max validation, and it matches what ContentEditor and RepeaterField already do. The regression test uses the reporter's case (min: 0.01, values 5.00 and 5.25) and checks the numeric payload, so it would fail if the step regressed. Both reviewers approved the code change. One reviewer raised two points: the changeset describes only one case of the bug, and the same bug exists in the admin content editor's BlockKitFieldWidget. The other reviewer found no issues. The advisory verdict is comment because the changeset finding is marked needs_fixing.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
A focused number input could block saving the content editor with Enter. Use the declared range for validation and cover decimal saves with a zero, fractional, or unspecified minimum.
There was a problem hiding this comment.
The follow-up takes the right approach: applying step="any" to sandboxed field widgets fixes the same decimal-validation problem on the content-editor path, while forwarding the declared bounds preserves range validation.
Both earlier findings are addressed. The changeset now describes decimal inputs generally and includes the admin package. The expanded tests cover absent and zero minimums, and the new editor regression checks numeric decimal saving via Enter and invalid range values.
I reviewed the follow-up diff, surrounding widget and editor code, regression tests, and changeset guidance. No new issues found. Review was static; I did not run tests or builds.
Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.
|
I have read the CLA Document and I hereby sign the CLA |
What does this PR do?
Allows in-range decimals in Block Kit forms and in sandboxed plugin field widgets in the content editor. The default HTML step of one caused a form with a minimum of
0.01to reject a £5.00 price. It also prevented a content editor widget from saving5.25when the author pressed Enter.Both renderers now use
step="any". The field widget also passes the plugin's declaredminandmaxto the number input. Related content editor fix #3791Closes #5132
Type of change
Your connection to this change
The failure surfaced while setting a price in EmDash Memberships. The standalone Block Kit Playground reproduces it with a single number field.
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI assistance disclosure
Screenshots / test output
Block Kit form
Sandboxed field widget in the content editor
On the published 1.6.0 renderer, submitting
5.25dispatched zero actions with no minimum, a zero minimum, or a minimum of0.01. Each dispatched one numeric price after the patch. The Chromium content editor test also saved5.25and rejected0and10.01for a widget declaring the range0.01–10.ContentEditor.test.tsxandembedded-plugin-form.test.tsxpassed.