From 14dd564b0ad68440781387e2ffb614a20b7dd240 Mon Sep 17 00:00:00 2001 From: Loris Sigrist Date: Tue, 24 Oct 2023 10:54:04 +0200 Subject: [PATCH] Better a11y --- site/src/lib/ui/Code/CodeGroupHeader.svelte | 11 ++++++++--- site/src/lib/ui/Code/CodePanel.svelte | 22 ++++++++++++--------- site/src/lib/ui/Code/CopyButton.svelte | 8 +++++--- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/site/src/lib/ui/Code/CodeGroupHeader.svelte b/site/src/lib/ui/Code/CodeGroupHeader.svelte index 50d5e36..68d1fd4 100644 --- a/site/src/lib/ui/Code/CodeGroupHeader.svelte +++ b/site/src/lib/ui/Code/CodeGroupHeader.svelte @@ -10,6 +10,9 @@ /** @type {import("svelte/store").Writable}*/ const activeTab = getContext("code-group-active-tab"); + + /** @type {string}*/ + const codeGroupId = getContext("code-group-id");
{#each $tabs as tab, i} {@const active = i === $activeTab} {/each} diff --git a/site/src/lib/ui/Code/CodePanel.svelte b/site/src/lib/ui/Code/CodePanel.svelte index a596ca7..7760d56 100644 --- a/site/src/lib/ui/Code/CodePanel.svelte +++ b/site/src/lib/ui/Code/CodePanel.svelte @@ -13,17 +13,21 @@ const tabs = getContext("code-group-tabs"); /** @type {import("svelte/store").Writable}*/ const activeTab = getContext("code-group-active-tab"); + /** @type {string}*/ + const codeGroupId = getContext("code-group-id"); tabs.update((oldTabs) => [...oldTabs, name]); - $: active = $tabs.findIndex((tab) => tab === name) === $activeTab; -{#if active} -
- {#if label || tag} - - {/if} - -
-{/if} + diff --git a/site/src/lib/ui/Code/CopyButton.svelte b/site/src/lib/ui/Code/CopyButton.svelte index 94113e9..71f69b1 100644 --- a/site/src/lib/ui/Code/CopyButton.svelte +++ b/site/src/lib/ui/Code/CopyButton.svelte @@ -7,10 +7,11 @@