web/updates: keyboard navigation

This commit is contained in:
dumbmoron 2024-07-16 17:27:43 +00:00
parent 678adfbda4
commit 5c07afe4ff
No known key found for this signature in database

View file

@ -52,6 +52,11 @@
changelogs[next]().catch(() => {});
}
const handleKeydown = (e: KeyboardEvent) => {
if (e.key === 'ArrowLeft') loadPrev();
else if (e.key === 'ArrowRight') loadNext();
}
$: prev = versions[currentIndex - 1];
$: next = versions[currentIndex + 1];
$: currentIndex, loadChangelog();
@ -112,6 +117,8 @@
</title>
</svelte:head>
<svelte:window on:keydown|preventDefault={handleKeydown} />
<div class="news">
{#if changelog}
<div class="button-wrapper-desktop">
@ -150,4 +157,4 @@
</button>
</div>
{/if}
</div>
</div>