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] combo box form element must always have a label #2608

Closed
shkeating opened this issue Sep 29, 2023 · 2 comments · Fixed by #2636
Closed

[fix] combo box form element must always have a label #2608

shkeating opened this issue Sep 29, 2023 · 2 comments · Fixed by #2636
Labels
a11y Relates to accessibility standards and practices good first issue Good for newcomers Hacktoberfest

Comments

@shkeating
Copy link
Contributor

shkeating commented Sep 29, 2023

ReactUSWDS Version: 5.4.0 & USWDS Version: 3.6.0

Describe the bug

In our storybook examples of the Combo box component, we do not always include a label.

In the USWDS docs about the combo box, it is explicitly called out that we must always use a label on this component. We should not include examples where it is unlabelled in our project storybook. The following examples lack a label:

Potentially, we should hard code a label right into the component file, and have that label's content be added as a prop to help guide react-uswds users to ensure they don't forget it in their implementations. I could be convinced of either approach, as both have pros and cons. This could be potentially cumbersome to projects already using react-uswds that have already added labels of their own who later upgrade versions.

It is also worth flagging though, that the combo box has other known accessibility issues that the USWDS team is aware of:

In late 2022, we found some combo box usability issues when we were testing with people who use screen readers and alternative input devices. For more information, see the issue on GitHub.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Default Combo box and With Default Value
  2. See there is no label

Expected behavior

All visible versions of the combo box in our storybook should have labels to prevent confusion that they are optional, when they are mandatory for this component.

Additional context

Screenshots

image
@shkeating shkeating added good first issue Good for newcomers a11y Relates to accessibility standards and practices Hacktoberfest labels Sep 29, 2023
@paulkim26
Copy link

Neat project! I would be interested in taking on this issue.

I can see the case both for and against hard coding a label property right into the ComboBox component. For the sake of maintaining compatibility with existing implementations, I propose label elements are kept separate from the ComboBox component and are just added to these examples.

While hard coding the label element into ComboBox would be one way of guaranteeing that particular accessibility requirement, it is troublesome on a semantic level to merge traditionally disparate block-level elements into the same UI component, in my opinion.

@m7adeel
Copy link
Contributor

m7adeel commented Oct 21, 2023

Hello @shkeating, I would like to solve this issue using the first approach (i.e hard coding a label in src/components/forms/ComboBox/ComboBox.stories.tsx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Relates to accessibility standards and practices good first issue Good for newcomers Hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants