added focus/hover states to nav items
This commit is contained in:
parent
defd5621bb
commit
a24618a873
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
export let destination: Pane;
|
export let destination: Pane;
|
||||||
|
|
||||||
|
$: selected = destination === $pane;
|
||||||
|
|
||||||
function handleKey({ key }: KeyboardEvent) {
|
function handleKey({ key }: KeyboardEvent) {
|
||||||
if (key === ' ' || key === 'Enter' || key === 'Spacebar') {
|
if (key === ' ' || key === 'Enter' || key === 'Spacebar') {
|
||||||
navigate();
|
navigate();
|
||||||
@ -16,9 +18,10 @@
|
|||||||
|
|
||||||
<li
|
<li
|
||||||
aria-controls={`pane-${$pane}`}
|
aria-controls={`pane-${$pane}`}
|
||||||
aria-selected={destination === $pane}
|
aria-selected={selected}
|
||||||
role="tab"
|
role="tab"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
class:selected
|
||||||
on:click={navigate}
|
on:click={navigate}
|
||||||
on:keyup={handleKey}
|
on:keyup={handleKey}
|
||||||
>
|
>
|
||||||
@ -31,6 +34,16 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: @padding-md;
|
padding: @padding-md;
|
||||||
text-align: center;
|
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) {
|
li:not(:last-of-type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user