mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-22 14:35:20 +00:00
feat: Use aria-current instead of visual only indicator (#173)
This commit is contained in:
committed by
GitHub
parent
3a7d96d3eb
commit
f52c6869f2
@@ -26,12 +26,12 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected {
|
[aria-current] {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected::after {
|
[aria-current]::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: '';
|
content: '';
|
||||||
width: calc(100% - 1em);
|
width: calc(100% - 1em);
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a class:selected='{segment === undefined}' href='.'>home</a></li>
|
<li><a aria-current='{segment === undefined ? "page" : undefined}' href='.'>home</a></li>
|
||||||
<li><a class:selected='{segment === "about"}' href='about'>about</a></li>
|
<li><a aria-current='{segment === "about" ? "page" : undefined}' href='about'>about</a></li>
|
||||||
|
|
||||||
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
|
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
|
||||||
the blog data when we hover over the link or tap it on a touchscreen -->
|
the blog data when we hover over the link or tap it on a touchscreen -->
|
||||||
<li><a rel=prefetch class:selected='{segment === "blog"}' href='blog'>blog</a></li>
|
<li><a rel=prefetch aria-current='{segment === "blog" ? "page" : undefined}' href='blog'>blog</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user