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(() => {});
|
||||
}
|
||||
|
||||
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>
|
||||
|
|
Loading…
Reference in a new issue