web/updates: keyboard navigation
This commit is contained in:
parent
678adfbda4
commit
5c07afe4ff
1 changed files with 8 additions and 1 deletions
|
@ -52,6 +52,11 @@
|
||||||
changelogs[next]().catch(() => {});
|
changelogs[next]().catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleKeydown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'ArrowLeft') loadPrev();
|
||||||
|
else if (e.key === 'ArrowRight') loadNext();
|
||||||
|
}
|
||||||
|
|
||||||
$: prev = versions[currentIndex - 1];
|
$: prev = versions[currentIndex - 1];
|
||||||
$: next = versions[currentIndex + 1];
|
$: next = versions[currentIndex + 1];
|
||||||
$: currentIndex, loadChangelog();
|
$: currentIndex, loadChangelog();
|
||||||
|
@ -112,6 +117,8 @@
|
||||||
</title>
|
</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
|
<svelte:window on:keydown|preventDefault={handleKeydown} />
|
||||||
|
|
||||||
<div class="news">
|
<div class="news">
|
||||||
{#if changelog}
|
{#if changelog}
|
||||||
<div class="button-wrapper-desktop">
|
<div class="button-wrapper-desktop">
|
||||||
|
@ -150,4 +157,4 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue