Skip to content

Commit 09cf1de

Browse files
committed
Fix animation on desktop menu nav items
1 parent 7efc541 commit 09cf1de

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎src/components/Header/index.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const { path } = Astro.props
5050
{/* Header for all pages */}
5151
<header
5252
id="header"
53-
class="flex flex-row items-center justify-between py-2 lg:py-3 relative px-4 sm:px-6 lg:px-8"
53+
class="flex flex-row items-center justify-between py-2 lg:py-3 relative"
5454
role="banner"
5555
>
5656
{/*- Element for animated background behind mobile navigation menu -*/}

‎src/components/Navigation/menu.module.css‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
transition: transform 0.3s cubic-bezier(0.86, 0, 0.07, 1) 0.1s;
4242
}
4343

44-
.mainNavItem:hover::after,
45-
.mainNavItem:focus-within::after {
44+
.mainNavItem:hover::after {
4645
transform: scaleX(1);
4746
}
4847

@@ -60,13 +59,21 @@
6059
.mainNavLink {
6160
color: var(--color-primary-offset);
6261
text-decoration: underline dotted var(--color-primary-offset) 2px;
62+
text-decoration-color: var(--color-primary-offset);
6363
text-underline-offset: 8px;
64+
transition: color 0.2s ease, text-decoration-color 0s linear 0.4s;
6465
}
6566

6667
.mainNavLink:hover,
67-
.mainNavLink:focus {
68+
.mainNavLink:focus-visible {
6869
color: var(--color-primary);
6970
text-decoration-color: transparent;
71+
transition: color 0.2s ease, text-decoration-color 0s linear 0s;
72+
}
73+
74+
.mainNavLink:focus-visible {
75+
outline: 2px solid var(--color-spotlight);
76+
outline-offset: 4px;
7077
}
7178

7279
.navItemActive a,

0 commit comments

Comments
 (0)