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: adding labels in combo box (default combo box, with default value) #2636

Merged
merged 6 commits into from
Nov 3, 2023

Conversation

m7adeel
Copy link
Contributor

@m7adeel m7adeel commented Oct 22, 2023

Summary

According to the USWDS docs the combo box should always have a label. Some of the examples in the storybook do not have labels. So the commit adds labels in the component file src/components/forms/ComboBox/ComboBox.stories.tsx to avoid confusion that they are optional.

Related Issues or PRs

Closes #2608

How To Test

  1. Go to Default Combo box and With Default Value
  2. Users can see that there is a label added to them

Screenshots (optional)

default
with_default_value

@m7adeel m7adeel requested a review from a team as a code owner October 22, 2023 22:56
@rileyorr
Copy link

@trussworks/react-uswds-design-owners I'll review this PR 👍

rileyorr
rileyorr previously approved these changes Oct 23, 2023
Copy link

@rileyorr rileyorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this - LGTM!

The only thing I might consider either as part of this PR or a separate one is potentially removing the With Label use case since the default combo box already includes a label. It might help clean up the documentation; however, it might impact teams already using that component.

@@ -72,7 +74,7 @@ export const withLabel = (): React.ReactElement => {

return (
<Form onSubmit={noop}>
<Label htmlFor="fruit">Select a fruit</Label>
<Label htmlFor="fruit">Select a Fruit</Label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The labels should be sentence case (see USWDS example):

Suggested change
<Label htmlFor="fruit">Select a Fruit</Label>
<Label htmlFor="fruit">Select a fruit</Label>

Copy link
Contributor

@brandonlenz brandonlenz Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same for the others added on this PR)

@m7adeel
Copy link
Contributor Author

m7adeel commented Nov 3, 2023

Hello @brandonlenz, Can you kindly review my PR

@brandonlenz brandonlenz merged commit 7714d14 into trussworks:main Nov 3, 2023
7 checks passed
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.

[fix] combo box form element must always have a label
3 participants