Skip to content

Commit dbebf72

Browse files
committed
Merge branch 'upload-gix' of https://github.com/primer/css into upload-gix
2 parents f5d04da + 1848006 commit dbebf72

File tree

2 files changed

+54
-50
lines changed

2 files changed

+54
-50
lines changed

.changeset/ninety-bobcats-do.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/css": major
3+
---
4+
5+
UnderlineNav bug fix

src/navigation/underline-nav.scss

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// stylelint-disable selector-max-specificity
21
$nav-height: $spacer-3 * 3 !default; // 48px
32

43
.UnderlineNav {
@@ -10,6 +9,17 @@ $nav-height: $spacer-3 * 3 !default; // 48px
109
box-shadow: inset 0 -1px 0 var(--color-border-muted);
1110
-webkit-overflow-scrolling: auto;
1211
justify-content: space-between;
12+
13+
.Counter {
14+
margin-left: $spacer-2;
15+
color: var(--color-fg-default);
16+
background-color: var(--color-neutral-muted);
17+
18+
&--primary {
19+
color: var(--color-fg-on-emphasis);
20+
background-color: var(--color-neutral-emphasis);
21+
}
22+
}
1323
}
1424

1525
.UnderlineNav-body {
@@ -41,65 +51,54 @@ $nav-height: $spacer-3 * 3 !default; // 48px
4151
color: var(--color-fg-default);
4252
text-decoration: none;
4353
border-bottom-color: var(--color-neutral-muted);
44-
outline-offset: -8px;
54+
outline-offset: -2px;
4555
transition: border-bottom-color 0.12s ease-out;
56+
}
4657

47-
// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
48-
[data-content]::before {
49-
display: block;
50-
height: 0;
51-
font-weight: $font-weight-bold;
52-
visibility: hidden;
53-
content: attr(data-content);
54-
}
55-
56-
// increase touch target area
57-
&::before {
58-
@include minTouchTarget($min-height: $nav-height);
59-
}
58+
// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
59+
[data-content]::before {
60+
display: block;
61+
height: 0;
62+
font-weight: $font-weight-bold;
63+
visibility: hidden;
64+
content: attr(data-content);
65+
}
6066

61-
// hover state was "sticking" on mobile after click
62-
@media (pointer: fine) {
63-
&:hover {
64-
color: var(--color-fg-default);
65-
text-decoration: none;
66-
background: var(--color-action-list-item-default-hover-bg);
67-
transition: background 0.12s ease-out;
68-
}
69-
}
67+
// increase touch target area
68+
&::before {
69+
@include minTouchTarget($min-height: $nav-height);
70+
}
7071

71-
&.selected,
72-
&[role='tab'][aria-selected='true'],
73-
&[aria-current]:not([aria-current='false']) {
74-
font-weight: $font-weight-bold;
72+
// hover state was "sticking" on mobile after click
73+
@media (pointer: fine) {
74+
&:hover {
7575
color: var(--color-fg-default);
76-
border-bottom-color: var(--color-primer-border-active);
77-
outline-offset: -8px;
78-
79-
// current/selected underline
80-
&::after {
81-
position: absolute;
82-
right: 50%;
83-
// 48px total height / 2 (24px) + 1px
84-
bottom: calc(50% - 25px);
85-
width: 100%;
86-
height: 2px;
87-
content: '';
88-
background: var(--color-primer-border-active);
89-
border-radius: $border-radius;
90-
transform: translate(50%, -50%);
91-
}
76+
text-decoration: none;
77+
background: var(--color-action-list-item-default-hover-bg);
78+
transition: background 0.12s ease-out;
9279
}
9380
}
9481

95-
.Counter {
96-
margin-left: $spacer-2;
82+
&.selected,
83+
&[role='tab'][aria-selected='true'],
84+
&[aria-current]:not([aria-current='false']) {
85+
font-weight: $font-weight-bold;
9786
color: var(--color-fg-default);
98-
background-color: var(--color-neutral-muted);
87+
border-bottom-color: var(--color-primer-border-active);
88+
outline-offset: -8px;
9989

100-
&--primary {
101-
color: var(--color-fg-on-emphasis);
102-
background-color: var(--color-neutral-emphasis);
90+
// current/selected underline
91+
&::after {
92+
position: absolute;
93+
right: 50%;
94+
// 48px total height / 2 (24px) + 1px
95+
bottom: calc(50% - 25px);
96+
width: 100%;
97+
height: 2px;
98+
content: '';
99+
background: var(--color-primer-border-active);
100+
border-radius: $border-radius;
101+
transform: translate(50%, -50%);
103102
}
104103
}
105104
}

0 commit comments

Comments
 (0)