Skip to content

Commit

Permalink
[fix] use aria-current instead of active class (#7376)
Browse files Browse the repository at this point in the history
fixes #7353
  • Loading branch information
Rich-Harris authored Oct 25, 2022
1 parent 640f61f commit def0f60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-mirrors-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Use aria-current instead of active class in nav
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
</svg>
<ul>
<li class:active={$page.url.pathname === '/'}>
<li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
<a href="/">Home</a>
</li>
<li class:active={$page.url.pathname === '/about'}>
<li aria-current={$page.url.pathname === '/about' ? 'page' : undefined}>
<a href="/about">About</a>
</li>
<li class:active={$page.url.pathname.startsWith('/sverdle')}>
<li aria-current={$page.url.pathname.startsWith('/sverdle') ? 'page' : undefined}>
<a href="/sverdle">Sverdle</a>
</li>
</ul>
Expand Down Expand Up @@ -97,7 +97,7 @@
height: 100%;
}
li.active::before {
li[aria-current='page']::before {
--size: 6px;
content: '';
width: 0;
Expand Down

0 comments on commit def0f60

Please sign in to comment.