USWDS - Breadcrumb: Allow text to wrap on wrap variants#5497
Conversation
| .usa-breadcrumb__list-item { | ||
| @include sr-only; | ||
| @include u-display("inline"); | ||
| @include u-white-space("no-wrap"); |
There was a problem hiding this comment.
This appears to be unnecessary for the standard variant because no-wrap is already declared on the .usa-breadcrumb__list element in line 71. The line 71 rule is applied only to :not(.usa-breadcrumb--wrap), so no override is necessary.
| </li> | ||
| <li class="usa-breadcrumb__list-item usa-current" aria-current="page"> | ||
| <span>Women-owned small business federal contracting program</span> | ||
| <span>Economically disadvantaged women-owned small business federal contracting program</span> |
There was a problem hiding this comment.
Made the text longer to better demonstrate the text wrap
mejiaj
left a comment
There was a problem hiding this comment.
Looks good. Tested both variants in:
- Safari 16.6
- Firefox 118
- Chromium 116
mahoneycm
left a comment
There was a problem hiding this comment.
LGTM!
- Wrap variant properly wraps across different browsers
- No visual regression on standard variant across browsers
Chrome visual quirk
On chrome, I noticed a visual quirk in the standard variant where the ellipses overlaps the breadcrumb chevron. The same behavior exists on develop so I don't think it should be a blocker for this PR. I was unable to reproduce on Firefox or Safari.
Let me know if you'd like me to create a new issue to track this!

Summary
Fixed a bug that prevented text from wrapping to a new line in the
.usa-breadcrumb--wrapvariant.Breaking change
This is not a breaking change.
Related issue
Closes #5257
Related pull requests
Changelog PR
Preview link
Problem statement
In the breadcrumb component, all list items (regardless of variant) receive a
white-space: nowraprule. This enables the expected behavior in the standard variant, but prevents text from wrapping In the.usa-breadcrumb--wrapvariant.Solution
By removing the blanket
white-space: nowraprule from list items and instead relying only on the "no-wrap" rule applied to.usa-breadcrumb__listin the standard variant, we can re-enable text wrapping in the.usa-breadcrumb--wrapvariant.Testing and review
In a variety of browsers: