Skip to content
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: support step="any" in NumberControl and RangeControl #34816

Closed
4 of 6 tasks
ciampo opened this issue Sep 14, 2021 · 0 comments · Fixed by #34542
Closed
4 of 6 tasks

Components: support step="any" in NumberControl and RangeControl #34816

ciampo opened this issue Sep 14, 2021 · 0 comments · Fixed by #34542
Labels
[Feature] Component System WordPress component system [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@ciampo
Copy link
Contributor

ciampo commented Sep 14, 2021

What

Accept any as a valid value for the step prop of the NumberControl and RangeControl components

Why

The input[type=number] and input[type=range] HTML elements support any as a value for the step attribute (#, #).

NumberControl and RangeControl aim at being a superset of these components, and should therefore support the step="any" case. Currently, this is not supported and causes the value of the inputs to become NaN

Also, partially related: #33156

A/C

  • Introduce support for step="any" to NumberControl and RangeControl, following the expected behaviour from the HTML spec
  • Add Storybook examples for both components
  • Update the step prop docs in both components README:
    • The property can now be of type number | "any"
    • Add a paragraph explaining the how the component should behave when passing "any"
  • Add a CHANGELOG entry in the @wordpress/components package
@ciampo ciampo added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components [Feature] Component System WordPress component system labels Sep 14, 2021
@ciampo ciampo mentioned this issue Oct 1, 2021
62 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Component System WordPress component system [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant