Skip to content

Commit 028f740

Browse files
committed
use aria-current instead of active class - fixes #7353
1 parent acbbf12 commit 028f740

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/healthy-mirrors-hide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-svelte': patch
3+
---
4+
5+
Use aria-current instead of active class in nav

packages/create-svelte/templates/default/src/routes/Header.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
1717
</svg>
1818
<ul>
19-
<li class:active={$page.url.pathname === '/'}>
19+
<li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
2020
<a href="/">Home</a>
2121
</li>
22-
<li class:active={$page.url.pathname === '/about'}>
22+
<li aria-current={$page.url.pathname === '/about' ? 'page' : undefined}>
2323
<a href="/about">About</a>
2424
</li>
25-
<li class:active={$page.url.pathname.startsWith('/sverdle')}>
25+
<li aria-current={$page.url.pathname.startsWith('/sverdle') ? 'page' : undefined}>
2626
<a href="/sverdle">Sverdle</a>
2727
</li>
2828
</ul>
@@ -97,7 +97,7 @@
9797
height: 100%;
9898
}
9999
100-
li.active::before {
100+
li[aria-current='page']::before {
101101
--size: 6px;
102102
content: '';
103103
width: 0;

0 commit comments

Comments
 (0)