From 52a22583ad481d70cbca27ee9b068c11bc879f50 Mon Sep 17 00:00:00 2001 From: "Azat S." Date: Wed, 17 Jul 2024 22:39:08 +0300 Subject: [PATCH] docs: improve website a11y --- astro.config.ts | 39 ++++++++++++++------------- docs/components/Button.svelte | 1 + docs/components/CodeTabs.svelte | 2 ++ docs/components/Container.astro | 11 +++++++- docs/components/Header.astro | 7 ++++- docs/components/Icon.astro | 14 ++++++---- docs/components/Navigation.astro | 7 ++++- docs/components/Sidebar/Sidebar.astro | 1 + 8 files changed, 56 insertions(+), 26 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index 59a4b53a..0af0c188 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -15,6 +15,7 @@ import { remarkHeadings } from './docs/plugins/remark-headings' import { colorTheme } from './docs/utils/shiki-theme' let dirname = fileURLToPath(path.dirname(import.meta.url)) +let site = 'https://perfectionist.dev' export default defineConfig({ markdown: { @@ -40,22 +41,6 @@ export default defineConfig({ ], remarkPlugins: [remarkSectionize, remarkHeadings], }, - vite: { - css: { - lightningcss: { - targets: browserslistToTargets( - browserslist(null, { - config: path.join(dirname, './.browserslistrc'), - }), - ), - }, - transformer: 'lightningcss', - }, - plugins: [ - // @ts-ignore - svelteSvg(), - ], - }, integrations: [ compress({ JavaScript: true, @@ -70,9 +55,27 @@ export default defineConfig({ discloseVersion: false, }, }), - sitemap(), + sitemap({ + filter: page => !new RegExp(`^${site}/guide$`).test(page), + }), mdx(), ], + vite: { + css: { + lightningcss: { + targets: browserslistToTargets( + browserslist(null, { + config: path.join(dirname, './.browserslistrc'), + }), + ), + }, + transformer: 'lightningcss', + }, + plugins: [ + // @ts-ignore + svelteSvg(), + ], + }, prefetch: { defaultStrategy: 'viewport', prefetchAll: true, @@ -91,6 +94,6 @@ export default defineConfig({ }, srcDir: path.join(dirname, './docs'), root: path.join(dirname, './docs'), - site: 'https://perfectionist.dev', compressHTML: true, + site, }) diff --git a/docs/components/Button.svelte b/docs/components/Button.svelte index bf4745e3..65cc20b6 100644 --- a/docs/components/Button.svelte +++ b/docs/components/Button.svelte @@ -8,6 +8,7 @@ class:button-primary={color === 'primary'} on:click={onClick} class="button" + type="button" > diff --git a/docs/components/CodeTabs.svelte b/docs/components/CodeTabs.svelte index 6356b8c5..5d996b85 100644 --- a/docs/components/CodeTabs.svelte +++ b/docs/components/CodeTabs.svelte @@ -47,6 +47,7 @@ }} class:active-tab={mounted && $codeSettings[type] === codeValue.value} aria-selected={$codeSettings[type] === codeValue.value} + type="button" class="tab" role="tab" > @@ -74,6 +75,7 @@ class:copy-button-copied={copied} class="copy-button" on:click={copyCode} + type="button" > {#if copied} diff --git a/docs/components/Container.astro b/docs/components/Container.astro index 404e9114..e1b24aff 100644 --- a/docs/components/Container.astro +++ b/docs/components/Container.astro @@ -10,7 +10,16 @@ let { class: className, tag = 'div', size = 'm', ...rest } = Astro.props let Tag = tag --- - + diff --git a/docs/components/Header.astro b/docs/components/Header.astro index b47de9e2..dd0a7729 100644 --- a/docs/components/Header.astro +++ b/docs/components/Header.astro @@ -14,7 +14,12 @@ let { border = false } = Astro.props