Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
langermank committed Apr 20, 2022
1 parent a859750 commit f84874e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
83 changes: 42 additions & 41 deletions src/navigation/underline-nav.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// stylelint-disable selector-max-specificity
$nav-height: $spacer-3 * 3 !default; // 48px

.UnderlineNav {
Expand Down Expand Up @@ -43,51 +44,51 @@ $nav-height: $spacer-3 * 3 !default; // 48px
outline-offset: -8px;
transition: border-bottom-color 0.12s ease-out;

// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
[data-content]::before {
display: block;
height: 0;
font-weight: $font-weight-bold;
visibility: hidden;
content: attr(data-content);
}

// increase touch target area
&::before {
@include minTouchTarget($min-height: $nav-height);
}

// hover state was "sticking" on mobile after click
@media (pointer: fine) {
&:hover {
color: var(--color-fg-default);
text-decoration: none;
background: var(--color-action-list-item-default-hover-bg);
transition: background 0.12s ease-out;
// renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
[data-content]::before {
display: block;
height: 0;
font-weight: $font-weight-bold;
visibility: hidden;
content: attr(data-content);
}

}
// increase touch target area
&::before {
@include minTouchTarget($min-height: $nav-height);
}

&.selected,
&[role='tab'][aria-selected='true'],
&[aria-current]:not([aria-current='false']) {
font-weight: $font-weight-bold;
color: var(--color-fg-default);
border-bottom-color: var(--color-primer-border-active);
outline-offset: -8px;
// hover state was "sticking" on mobile after click
@media (pointer: fine) {
&:hover {
color: var(--color-fg-default);
text-decoration: none;
background: var(--color-action-list-item-default-hover-bg);
transition: background 0.12s ease-out;
}
}

// current/selected underline
&::after {
position: absolute;
right: 50%;
// 48px total height / 2 (24px) + 1px
bottom: calc(50% - 25px);
width: 100%;
height: 2px;
content: '';
background: var(--color-primer-border-active);
border-radius: $border-radius;
transform: translate(50%, -50%);
&.selected,
&[role='tab'][aria-selected='true'],
&[aria-current]:not([aria-current='false']) {
font-weight: $font-weight-bold;
color: var(--color-fg-default);
border-bottom-color: var(--color-primer-border-active);
outline-offset: -8px;

// current/selected underline
&::after {
position: absolute;
right: 50%;
// 48px total height / 2 (24px) + 1px
bottom: calc(50% - 25px);
width: 100%;
height: 2px;
content: '';
background: var(--color-primer-border-active);
border-radius: $border-radius;
transform: translate(50%, -50%);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/support/mixins/misc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
outline: 2px solid $outlineColor;
outline-offset: $outlineOffset;
box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);
}

// if min-width is undefined, return only min-height
@mixin minTouchTarget($min-height: 32px, $min-width: '') {
Expand Down

0 comments on commit f84874e

Please sign in to comment.