-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
NumberControl: Fix invalid HTML attributes for infinite bounds #69033
base: trunk
Are you sure you want to change the base?
NumberControl: Fix invalid HTML attributes for infinite bounds #69033
Conversation
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. |
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.
Left some suggestion.
min={ min === -Infinity ? undefined : min } | ||
max={ max === Infinity ? undefined : max } |
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.
Why prop position changed? Can you please update to use max first and min later?
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.
Thank you for the feedback, I've updated the PR to maintain consistent prop ordering.
Hi @hbhalodia, I have implemented the changes and requested for review. Please review it at your convince. |
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.
LGTM! as per the screencast attached.
cc @WordPress/gutenberg-components |
Thanks! Looks good to merge with a changelog entry 👍 |
Closes: #69022
What?
Fixes invalid HTML attributes in the NumberControl component where
min="-Infinity"
andmax="Infinity"
are being rendered.Why?
The NumberControl component currently uses JavaScript's Infinity and -Infinity values as HTML attributes for min and max, which is invalid according to the HTML. It requires min and max attributes to have valid floating-point numbers as values.
How?
Modified the NumberControl component to omit the min/max attributes entirely when their values are infinite by using undefined:
Testing Instructions
Number Control
componentScreencast:
Screen.Recording.2025-02-05.at.10.45.58.AM.mov