-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: breadcrumb with single character fails wcag 2.2 target size #19287
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: breadcrumb with single character fails wcag 2.2 target size #19287
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19287 +/- ##
=======================================
Coverage 84.78% 84.78%
=======================================
Files 371 371
Lines 14411 14411
Branches 4713 4747 +34
=======================================
Hits 12218 12218
Misses 2044 2044
Partials 149 149 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -49,6 +49,11 @@ | |||
margin-inline-end: $spacing-02; | |||
} | |||
|
|||
.#{$prefix}--breadcrumb--sm .#{$prefix}--breadcrumb-item .#{$prefix}--link { | |||
justify-content: center; | |||
min-inline-size: $spacing-04; |
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.
@warrenmblood had mentioned this issue with the Target size doesn't exist in Web Components because the margin is 8px instead of 4px in React - I wonder if we need to discuss with design to see if it's just an issue of adjusting the margins? or if this fix needs to be applied to WC too (setting the margin to 4px to align with React and then applying this same fix)?

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.
I thought to avoid changing the margins because it would affect all breadcrumbs, not just the single-character ones, which could potentially break the existing design for current users. I think it's a good idea to confirm with Design.
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.
I agree with discussing this with design first and deciding how to match WC and React, but these changes look good to me for preventing the WCAG target size failure!
…-wcag-target-size
Ok great, let's adjust the margin on WC small breadcrumb since it's currently 8px and confirm the min-width also gets applied there too! |
Applied the same changes to web-components as well to make them align. Please review |
const items = document | ||
.querySelector(`${prefix}-breadcrumb`) | ||
?.querySelectorAll(`${prefix}-breadcrumb-item`); |
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.
const items = document | |
.querySelector(`${prefix}-breadcrumb`) | |
?.querySelectorAll(`${prefix}-breadcrumb-item`); | |
const items = this.querySelectorAll(`${prefix}-breadcrumb-item`); |
You'll want to scope the querySelector to the current instance of breadcrumb instead of document
otherwise if there are other instances of breadcrumb on the page, it will affect those other instances as well
@@ -29,7 +29,7 @@ class CDSBreadcrumb extends LitElement { | |||
* Specify the size of the Breadcrumb. Currently | |||
* supports the following: `sm` & `md` (default: 'md') | |||
*/ | |||
@property() | |||
@property({ type: BREADCRUMB_SIZE, reflect: true, attribute: 'size' }) |
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.
@property({ type: BREADCRUMB_SIZE, reflect: true, attribute: 'size' }) | |
@property({ type: BREADCRUMB_SIZE, reflect: true }) |
Also no need to set the attribute
here since the name is the same
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
990010d
Closes #19266
Breadcrumb with single character in small size fails to wcag 2.2 target size, it should be minimum 24 px.
Changelog
Changed
Provide a minimum width of 20px to breadcrumb item
Testing / Reviewing