1
0

added focus/hover states to nav items

This commit is contained in:
Nicola Clark 2024-10-11 01:45:12 -05:00
parent defd5621bb
commit a24618a873
Signed by: nicola
GPG Key ID: 3E1710E7FF08956C

View File

@ -3,6 +3,8 @@
export let destination: Pane;
$: selected = destination === $pane;
function handleKey({ key }: KeyboardEvent) {
if (key === ' ' || key === 'Enter' || key === 'Spacebar') {
navigate();
@ -16,9 +18,10 @@
<li
aria-controls={`pane-${$pane}`}
aria-selected={destination === $pane}
aria-selected={selected}
role="tab"
tabindex="0"
class:selected
on:click={navigate}
on:keyup={handleKey}
>
@ -31,6 +34,16 @@
margin: 0;
padding: @padding-md;
text-align: center;
transition: background-color 0.2s;
}
li.selected {
background-color: darken(@color-light, 20%);
}
li:focus,
li:hover {
background-color: darken(@color-light, 10%);
}
li:not(:last-of-type) {