aboutsummaryrefslogtreecommitdiff
path: root/source/library/components/TabBar.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'source/library/components/TabBar.svelte')
-rw-r--r--source/library/components/TabBar.svelte15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/library/components/TabBar.svelte b/source/library/components/TabBar.svelte
index 9c34f20..0bfec02 100644
--- a/source/library/components/TabBar.svelte
+++ b/source/library/components/TabBar.svelte
@@ -130,13 +130,22 @@
}
</style>
-<div class="tabbar">
+<div class="tabbar" role="tablist">
{#each tabs as tab (tab.id)}
- <button
+ <div
+ aria-selected={tab.id === activeId}
class="tab"
class:active={tab.id === activeId}
ondblclick={() => startEditing(tab)}
onclick={() => onSelect(tab.id)}
+ onkeydown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ onSelect(tab.id);
+ }
+ }}
+ role="tab"
+ tabindex="0"
>
{#if editingId === tab.id}
<input
@@ -157,7 +166,7 @@
class="close"
onclick={(e) => handleClose(e, tab.id)}
>×</button>
- </button>
+ </div>
{/each}
<button aria-label="New tab" class="add" onclick={onAdd}>+</button>
</div>