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

fix: do not display empty <label></label> #275

Merged
merged 1 commit into from
Jul 11, 2024
Merged

fix: do not display empty <label></label> #275

merged 1 commit into from
Jul 11, 2024

Conversation

ddecrulle
Copy link
Collaborator

The props label and hintText are ReactNodes. They can therefore be null, undefined, or an empty string (""). In these cases, the rendered HTML will be an empty <label> tag. This PR fixes this issue.

There is a side effect: if the provided label or hintText is the boolean false, it will not be displayed. I don't think this is problematic; it will simply require casting the boolean to a string.

@revolunet
Copy link
Collaborator

Thanks !

@ddecrulle ddecrulle merged commit c7cc7df into main Jul 11, 2024
6 checks passed
@garronej garronej deleted the empty-label branch July 11, 2024 13:22
@garronej
Copy link
Collaborator

Thanks!

@ddecrulle
Copy link
Collaborator Author

ddecrulle commented Aug 19, 2024

The DSFR components Checkbox, Radio, and Switch need the <label> to be properly displayed. I have reverted these components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants