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
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-gorillas-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react-brand': patch
---

Allow AnchorNav links to wrap to the next line in the expanded list on narrow viewports.
joshfarrant marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 5 additions & 2 deletions packages/react/src/AnchorNav/AnchorNav.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -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

width: 100%;
text-decoration: none;
height: 48px;
align-items: center;
Expand Down Expand Up @@ -206,7 +206,6 @@
letter-spacing: var(--brand-heading-letterSpacing-200);
color: var(--brand-color-text-default);
transition: color var(--brand-animation-easing-glide) var(--brand-animation-duration-faster);
white-space: nowrap;
position: relative;
}

Expand Down Expand Up @@ -252,6 +251,10 @@

/* Large breakpoint and up */
@media screen and (min-width: 63.25rem) {
.AnchorNav-link-label {
white-space: nowrap;
}

.AnchorNav-link-label::after {
content: '';
position: absolute;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.