-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
Discovered while investigating #68599 and similar issues.
By default, the NumberControl
component and other components that extend it e.g. UnitControl > ValueInpu > NumberControl use Infinity
and -Infinity
for the min and max HTMl attributes values.
That is: the rendered HTML attribute values is:
max="Infinity"
min="-Infinity"
Those aren't valid values, it's invalid HTML.
I'm not sure what was the reasoning about using Infinity
as default value. Shouldn't the max
and min
attributes be simply omitted to allow infinite values?
Reference:
https://html.spec.whatwg.org/multipage/input.html#the-min-and-max-attributes
https://html.spec.whatwg.org/multipage/input.html#number-state-(type=number)
The min attribute, if specified, must have a value that is a valid floating-point number. The max attribute, if specified, must have a value that is a valid floating-point number.
Cc @WordPress/gutenberg-components
Step-by-step reproduction instructions
- Go to the Storybook at https://wordpress.github.io/gutenberg/?path=/story/components-experimental-numbercontrol--default
- Inspect the source and observe the values are
max="Infinity"
andmin="-Infinity"
.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure