-
Notifications
You must be signed in to change notification settings - Fork 934
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
USWDS - Select: Include standard "multiple" stylings. Resolves #4423 #4766
Conversation
- Turning Multiple to true adds multiple and size attributes to markdown (twig) - Setting size to 0 defaults in 4 row height as standard for multiple select when size is absent
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.
Looks like this is working well!
A couple of thoughts:
-
We should have a separate story in Storybook for when
multipleis true -
The padding on the select box can cause text to get cut off if the
sizeis less than the item count. It might be better to add the padding to the options whenmultipleis true.

-
Additionally, we have this note in our docs for select:
"When to consider something else: Multi-select. If you need to allow users to choose more than one option at once. Users often don’t understand how to choose multiple items from select elements. Use checkboxes instead."- Are we now allowing multiple select as a recommended practice? If this is now an acceptable pattern, we should remove this line, provide use-case recommendations, and should add some notes about both
multipleandsizein our documentation.
- Are we now allowing multiple select as a recommended practice? If this is now an acceptable pattern, we should remove this line, provide use-case recommendations, and should add some notes about both
Let me know if you have questions!
|
Thanks @amyleadem!
(of course the scroll bar is a good indicator)
|
I think the padding is coming from the default input styles. It seems expected to leave it in by default for this. I agree with Dan's comments. We're not recommending this as a new pattern, we're just making sure USWDS styles don't break the expected behavior. We also don't have research to suggest otherwise, so we can leave guidance as-is. Good consideration though! I agree with @amyleadem, a separate story would be better. |
- Restores select to it's original settings
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.
Thanks Charlie, I've added some feedback.
| <option value="value3">Option G</option> | ||
| </select> | ||
| </form> | ||
|
|
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.
Can we move this to a directory usa-select/test/test-patterns?
Similar to what we did with this component test template
https://github.com/uswds/uswds/blob/1db0e68d7e5cf21ae52f2d8a29d5963c7aa1b681/packages/usa-combo-box/src/test/test-patterns/test-usa-combo-box.twig
| @@ -1,9 +1,14 @@ | |||
| import Component from "./usa-select.twig"; | |||
| import Multiple from "./usa-select--multiple.twig"; | |||
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.
Let's create a test section in Storybook for this, see combobox example
https://github.com/uswds/uswds/blob/cm-select-multiple/packages/usa-combo-box/src/usa-combo-box.stories.js
- Creates it's own twig file with defaults set - Deletes now unused files
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.
Tiny changes, otherwise LGTM!
packages/usa-select/src/test/test-patterns/usa-select--multiple.twig
Outdated
Show resolved
Hide resolved
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.
Looks good to me!

Preview
Select →
Description
Resolves #4423
This PR
selectwhen the multiple attribute is presentHTML 5 standardmultipleattribute and setsizeattributesize = 0it will act as if thesizeattribute is absent and do the standard default of four rows.Additional information
Standard select:
Multiple Enabled:
New Storybook controls:
Before you hit Submit, make sure you’ve done whichever of these applies to you:
npm testand make sure the tests for the files you have changed have passed.