Skip to content

Commit

Permalink
Switch Tabs With Keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
atticuscornett committed Jan 19, 2024
1 parent 35eddcb commit e9f11ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Components/NavButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
checked = true;
page = id;
}
function handleKeydown(event){
if (event.key === "Enter"){
setPage();
}
}
</script>

<div>
<input type="radio" value={id} checked={checked} name="NavBarButton">
<label for={id} on:click={setPage}><div>{name}</div></label>
<label for={id} on:click={setPage} tabindex="0" on:keydown={handleKeydown}><div>{name}</div></label>
</div>

<style>
Expand Down

0 comments on commit e9f11ed

Please sign in to comment.