Skip to content

Commit 2362038

Browse files
authored
Show active accent bar on top-level sidebar articles (#62442)
1 parent 0b11460 commit 2362038

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
// The tree's typography now comes from @primer/react-brand NavList's own scale
22
// (level-1 section headers at size-200, leaves at size-100). This class is kept
3-
// as the wrapper hook for `data-testid="sidebar"`; intentionally has no rules.
3+
// as the wrapper hook for `data-testid="sidebar"`.
44
.sidebar {
5+
// Brand's NavList draws the active accent bar only on nested leaves — its rule
6+
// explicitly excludes level-1 (`.item--leaf:not(.item--level-1) .link[aria-current]`),
7+
// so a top-level article like "Quickstart" gets only the subtle background pill
8+
// and no green bar. Restore the bar for active top-level leaves to match nested
9+
// items. Brand's classes are hashed, so match on the stable substrings.
10+
:global([class*="NavList__item--leaf"][class*="NavList__item--level-1"])
11+
:global([class*="NavList__link"])[aria-current]:not(
12+
[aria-current="false"]
13+
)::before {
14+
content: "";
15+
position: absolute;
16+
// Level-1 links are shorter (~24px) than nested leaves, so use a small inset
17+
// to keep the bar roughly the height of the background pill rather than the
18+
// larger inset brand applies to taller nested items.
19+
inset-block: var(--base-size-2);
20+
// Level-1 leaves have no inline padding, so pull the bar into the NavList's
21+
// own inline padding gutter to sit left of the label — matching where brand
22+
// places the level-1 indicator on expandable section toggles.
23+
inset-inline-start: calc(-1 * var(--base-size-8));
24+
width: var(--base-size-4);
25+
border-radius: var(--base-size-2);
26+
background-color: var(--brand-NavList-activeIndicator-color);
27+
}
528
}

0 commit comments

Comments
 (0)