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

Allow text wrapping in AnchorNav #842

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Nov 29, 2024

Summary

Allow AnchorNav links to reflow on narrow viewports.

I'm not sure the component is meant to support longer link names in the first place as they don't look great on desktop, but for those cases where the text might just break onto the next line this change does offer a slightly better experience.

Note that this change doesn't make the AnchorNav work perfectly with arbitrarily-long link names, but it does make it a bit more flexible.

Steps to test:

  1. Modify the data of the Playground story in the AnchorNav storybook
  2. Reduce the viewport width until the text reflows.

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

Please try to provide before and after screenshots or videos

Before After

image

image

Copy link

changeset-bot bot commented Nov 29, 2024

🦋 Changeset detected

Latest commit: 81e5bd4

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

This PR includes changesets to release 6 packages
Name Type
@primer/react-brand Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook 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

Copy link
Contributor

github-actions bot commented Nov 29, 2024

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Nov 29, 2024

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@@ -134,7 +134,7 @@
*/
.AnchorNav-link {
display: flex;
width: calc(100% - 80px);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't remember what that 80px was originally doing, but it was probably something important 😄. Do you know @joshfarrant?

Copy link
Contributor Author

@joshfarrant joshfarrant Dec 2, 2024

Choose a reason for hiding this comment

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

I'm not entirely sure if I'm honest @rezrah. If you look at the snapshots you can see (by looking at the focus border) that the item was 80px narrower than you'd probably expect it to be. Maybe something in the implementation changed since this component was created which rendered that 80px no longer useful?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No worries, not a blocker

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

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

LGTM. Could you take a look at the snapshots again please, looks like there might be an issue there?

@joshfarrant joshfarrant merged commit 26f79f6 into main Dec 2, 2024
19 checks passed
@joshfarrant joshfarrant deleted the joshfarrant/a11y-anchornav-reflow branch December 2, 2024 16:32
@primer-css primer-css mentioned this pull request Dec 2, 2024
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