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: Allow Breadcrumb items to wrap #2869

Merged
merged 6 commits into from
May 30, 2024
Merged

fix: Allow Breadcrumb items to wrap #2869

merged 6 commits into from
May 30, 2024

Conversation

smockle
Copy link
Member

@smockle smockle commented May 28, 2024

What are you trying to accomplish?

Breadcrumb item text is currently prevented from wrapping (via white-space: nowrap), which means (at certain viewport sizes and zoom levels) text can overflow offscreen and require horizontal scrolling.

Relatedly, WCAG SC 1.4.10: Reflow states:

Content can be presented without loss of information or functionality, and without requiring scrolling in two dimensions…

Screenshots

Before After
Screenshot of Lookbook, in a narrow viewport and zoomed-in, with Breadcrumb text overflowing offscreen Screenshot of Lookbook, in a narrow viewport and zoomed-in, with Breadcrumb text wrapping and entirely visible
Screenshot of GitHub Classroom, in a narrow viewport and zoomed-in, with Breadcrumb text overflowing offscreen Screenshot of GitHub Classroom, in a narrow viewport and zoomed-in, with Breadcrumb text wrapping and entirely visible

Integration

No changes beyond bumping the version.

List the issues that this change affects.

Part of https://github.com/github/accessibility-audits/issues/7360 (Hubber login required) — This issue can be closed after 1. This PR is merged. 2. A new version of Primer View Components is published. 3. GitHub Classroom’s Primer View Components version is updated.

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

This is a one-line CSS change. It changes the presentation of Breadcrumbs’ text, but it does not change, add, or remove text.

What approach did you choose and why?

I chose to remove the line of CSS that prevented Breadcrumb text from wrapping. The default CSS permits wrapping.

Anything you want to highlight for special attention from reviewers?

Is there any truncation happening in Breadcrumb? If so, how will this change interact?

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@smockle smockle requested a review from a team as a code owner May 28, 2024 19:14
@smockle smockle requested review from lukasoppermann and removed request for a team May 28, 2024 19:14
Copy link

changeset-bot bot commented May 28, 2024

🦋 Changeset detected

Latest commit: 4ee72ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -1,7 +1,6 @@
.breadcrumb-item {
display: inline-block;
margin-left: -0.35em;
white-space: nowrap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, I think this was put in because of the truncation that's sometimes used with the breadcrumbs. Could you write a lookbook preview with the truncate-css and Truncate component to see if there's any bad effects there?

Copy link
Member Author

@smockle smockle May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! To clarify, are you asking for two stories—one using primer/css’ truncate and one using primer/view_components’ Truncate? Or, does the Truncate component use the truncate CSS under-the-hood, such that only a single story is necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use the deprecated Primer::Truncate for the CSS one and the Primer::Beta::Truncate for the standard way.

Copy link
Member Author

@smockle smockle May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stories added!

I don’t see any bad effects from removing white-space: nowrap.

Copy link
Contributor

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

@github-actions github-actions bot requested a review from a team as a code owner May 29, 2024 20:41
Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants