From 4fd6cfe668e8aaf3f92817379fc8e123a6caf24f Mon Sep 17 00:00:00 2001 From: Caleb Jasik Date: Thu, 22 Jul 2021 19:12:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=98=20DOC:=20improve=20a11y=20(#806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add `tabindex="0"` to `
` so that they are navigable by keyboard users if they overflow.

* Landmark elements should have unique names https://dequeuniversity.com/rules/axe/4.3/landmark-unique

* Page must have one main landmark https://dequeuniversity.com/rules/axe/4.3/landmark-one-main

- Main landmark must not be contained by another landmark https://dequeuniversity.com/rules/axe/4.3/landmark-main-is-top-level

* Heading level cannot increase by more than one

* Ensure that links with the same accessible name serve a similar purpose

https://dequeuniversity.com/rules/axe/4.3/identical-links-same-purpose

* Just update the accessible name and require context for the visible link name

* Fix CSS from the removal of the second 
* Revert heading level change --- docs/public/index.css | 14 +++++++------- docs/public/make-scrollable-code-focusable.js | 3 +++ docs/src/components/DocSidebar.tsx | 2 +- docs/src/components/SiteSidebar.astro | 2 +- docs/src/layouts/Main.astro | 19 ++++++++++--------- docs/src/pages/core-concepts/astro-pages.md | 2 +- docs/src/pages/guides/data-fetching.md | 4 ++-- docs/src/pages/guides/styling.md | 4 ++-- .../src/pages/reference/renderer-reference.md | 2 -- 9 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 docs/public/make-scrollable-code-focusable.js diff --git a/docs/public/index.css b/docs/public/index.css index e60e0bec4..f33c7c2eb 100644 --- a/docs/public/index.css +++ b/docs/public/index.css @@ -35,11 +35,11 @@ nav ul { padding: 0; } -.content main > * + * { +.content > section > * + * { margin-top: 1rem; } -.content main > :first-child { +.content > section > :first-child { margin-top: 0; } @@ -110,24 +110,24 @@ a { gap: 0.5rem; } -article main :is(ul, ol) > * + * { +article > section :is(ul, ol) > * + * { margin-top: 0.75rem; } -article main li > :is(p, pre, blockquote):not(:first-child) { +article > section li > :is(p, pre, blockquote):not(:first-child) { margin-top: 1rem; } -article main :is(ul, ol) { +article > section :is(ul, ol) { padding-left: 1em; } -article main ::marker { +article > section ::marker { font-weight: bold; color: var(--theme-text-light); } -article main iframe { +article > section iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; diff --git a/docs/public/make-scrollable-code-focusable.js b/docs/public/make-scrollable-code-focusable.js new file mode 100644 index 000000000..6fbf1eebe --- /dev/null +++ b/docs/public/make-scrollable-code-focusable.js @@ -0,0 +1,3 @@ +Array.from(document.getElementsByTagName("pre")).forEach((element) => { + element.setAttribute("tabindex", "0"); +}); diff --git a/docs/src/components/DocSidebar.tsx b/docs/src/components/DocSidebar.tsx index 6aacb3860..92f34ff61 100644 --- a/docs/src/components/DocSidebar.tsx +++ b/docs/src/components/DocSidebar.tsx @@ -28,7 +28,7 @@ const DocSidebar: FunctionalComponent<{ headers: any[]; editHref: string }> = ({ }, []); return ( -