-
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: Multiple select overflow #5268
Conversation
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.
@mahoneycm, this seems to resolve the issue, but unfortunately I was not able to see the ellipsis on Safari. I've added some notes below.
Here are some of the things I tested:
- On init, confirm ellipsis is present on long option text
- On focus, confirm background color extends the full width of the input
- Confirm screen reader reads entire text
- Tested on Firefox, Safari, Chrome
- Note, there is some behavior in Firefox that I didn't expect, but it appears to be native behavior in select boxes with
overflow-x: hiddenoptions.- If I hit tab once, focus moves to the entire input (Expected)
- If I hit tab again while focus is on the input, it focuses on the option with overflow text. (Not expected, for me at least)
- Some quick testing revealed that this happens in non-USWDS/standard multiple select boxes as well. Not sure if there is any action that can be taken here, just wanted to flag it in case anyone else noticed or if there is a workaround.
- Note, there is some behavior in Firefox that I didn't expect, but it appears to be native behavior in select boxes with
UpdateElipsis on SafariUnfortunately, it looks like Safari doesn't support We can either remove it so it's consistent across the board or keep it for Chrome and Firefox Removed all of the right-side paddingNow that we can't rely on the ellipses to stop the text from reaching the edge, I've removed the right side padding completely to allow the focus background to reach the edge of the select element. Results: Resolved Firefox keyboard behaviorSwitching |
|
@mejiaj @amyleadem Bumping for re-review once you all have availability after |
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! I performed the following tests:
- Move focus to the long text option item - Confirm content and background color extends the full width of the input
- Select the long text option item by moving focus to it then move focus out of the component - Confirm that the background color shows behind only the selected text and that the background color extends the full width of the input
- Tested on Firefox, Safari, Chrome
|
@mejiaj bumping for review ! |
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.
LGTM! I tested the following:
Visual crossbrowser testing
- Confirmed ellipsis in Chromium/Firefox.
- Confirmed Safari doesn't ― which is OK since this was flagged in description.
Code
Code looks good, no issues. It's unfortunate that the component is hardcoded HTML, so the template isn't reusable. That's not a blocker for this though ― and it'd require a new JSON file anyways. Also, unsure of removing padding right. Either way it doesn't make a huge impact. Just flagging these concerns.
@mahoneycm could you please update the PR description so the information/links are accurate?
|
@mejiaj thanks for flagging! Updated PR description and reopened changelog PR. If we want to adjust the right padding instead of getting rid of it completely, we could do something like this: Lmk what you think! |
|
@mejiaj It does result in odd styles for Safari |
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.
PR description is accurate & up-to-date. Approved!











Summary
Added ellipses to overflow text in the multiple variant of the select component. This provides a clear indication to users that there is text that extends beyond the select width.
Breaking change
This is not a breaking change.
Related issue
Closes #5047
Related pull requests
Site Changelog PR
Preview link
Multiple select →
Problem statement
Multiple select cuts off long options on Safari & Firefox due to browser styles changing the text color to white, and additional padding leftover from the single select's dropdown icon
Solution
Unfortunately, there is no way to wrap option text within a select element at this time. Instead, the component should convey that there is additional text not visible to the user. This will provide a better user experience for all multiple select users.
This still isn't ideal for users and developers should focus on allowing options to be completely visible within their selects by either increasing the select element width or using short, concise options.
Testing and review
Option CScreenshots
Before
Chrome:

Firefox

Safari

After
Chrome:

Firefox

Safari

git pull origin [base branch]to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch isdevelop).npm run prettier:scssto format any Sass updates.npm testand confirm that all tests pass.