-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[joy-ui][FormControl] Fix issue with the conditional setting of htmlFor
and id
attributes not functioning properly for form labels
#40180
Conversation
Netlify deploy previewhttps://deploy-preview-40180--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
Hey @ReaZzy, I have a few suggestions, your PR currently lacks a description. To help the reviewers understand the changes you've made, could you please add a brief description that outlines the purpose of the PR, any proposed changes, and if applicable, mention if you've added or modified tests. Additionally, as this PR addresses a specific issue, you can link it by adding Thanks for your contribution! A member of the team will review your PR soon. |
htmlFor
and id
attributes not working for form label
htmlFor
and id
attributes not working for form labelhtmlFor
and id
attributes not working for form label
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.
@ReaZzy I moved the tests out of the Input test block since the Input component isn't rendered. Everything seems fine to me now! It's a great first pull request at MUI!
htmlFor
and id
attributes not working for form labelhtmlFor
and id
attributes not functioning properly for form labels
As mentioned by PhillipWinder in the bug report, if either the
'id'
or'htmlFor'
is undefined, they are currently removed from the DOM instead of being set to their default values. This issue arises due toexternalForwardedProps
overridingadditionalProps
. To address this, we can fix the problem by conditionally addinghtmlFor
/id
toexternalForwardedProps
. Additionally, I have included tests to verify that the behaviour with undefined values is now correct.Fixes #40112.