From 266b4a3ec4e421c16468f88ef6baa0054e1d0c1a Mon Sep 17 00:00:00 2001
From: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
Date: Tue, 13 Dec 2022 00:34:10 +0100
Subject: [PATCH] Accessibility (a11y) clean up (#138)
* Add hidden skip to content for keyboard a11y
* update green.900 value
used for button background; increases contrast ratio
* adjusts light primary to green.700 for contrast
Improves contrast ratio when paired with yellow.50 and removes browser a11y warnings
* add aria-labels
* add lang to html element
* fix improperly ordered headers
We should not be using headers (h4/h5) for these aside navigations. Updated to remove browser warnings.
* add remaining aria-label
* add aria-label for mobile menu
---
src/components/UI/Header.tsx | 27 +++++++++++++++++++++-----
src/components/UI/docs/DocsNav.tsx | 4 ++--
src/components/UI/docs/DocumentNav.tsx | 4 ++--
src/components/UI/search/Search.tsx | 1 +
src/components/layouts/Footer.tsx | 6 +++---
src/components/layouts/MobileMenu.tsx | 1 +
src/pages/[...slug].tsx | 2 +-
src/pages/_document.tsx | 2 +-
src/pages/downloads.tsx | 2 +-
src/pages/index.tsx | 4 ++--
10 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/src/components/UI/Header.tsx b/src/components/UI/Header.tsx
index 2ff2b515b2..02cac559d6 100644
--- a/src/components/UI/Header.tsx
+++ b/src/components/UI/Header.tsx
@@ -19,13 +19,14 @@ export const Header: FC = () => {
justifyContent='space-between'
position='relative'
>
-
@@ -34,7 +35,22 @@ export const Header: FC = () => {
-
+
+
+ skip to content
+
+
+
{/* HEADER BUTTONS */}
@@ -58,6 +74,7 @@ export const Header: FC = () => {
bg: 'primary',
svg: { color: 'bg' }
}}
+ aria-label={`Toggle ${isDark ? 'light' : 'dark'} mode`}
>
{isDark ? : }
diff --git a/src/components/UI/docs/DocsNav.tsx b/src/components/UI/docs/DocsNav.tsx
index 91f8d37ce3..9e83404844 100644
--- a/src/components/UI/docs/DocsNav.tsx
+++ b/src/components/UI/docs/DocsNav.tsx
@@ -24,7 +24,7 @@ export const DocsNav: FC = ({ navLinks }) => {
}
return (
-
+
@@ -49,7 +49,7 @@ export const DocsNav: FC = ({ navLinks }) => {
color: 'bg'
}}
>
-
+
Documentation
diff --git a/src/components/UI/docs/DocumentNav.tsx b/src/components/UI/docs/DocumentNav.tsx
index 564e2ad8df..167d147c4f 100644
--- a/src/components/UI/docs/DocumentNav.tsx
+++ b/src/components/UI/docs/DocumentNav.tsx
@@ -20,8 +20,8 @@ export const DocumentNav: FC = ({ content }) => {
const activeHash = useActiveHash(parsedHeadings.map(heading => heading!.headingId));
return (
-
-
+
+
on this page
diff --git a/src/components/UI/search/Search.tsx b/src/components/UI/search/Search.tsx
index 41a6b364cf..c3aa1f1892 100644
--- a/src/components/UI/search/Search.tsx
+++ b/src/components/UI/search/Search.tsx
@@ -49,6 +49,7 @@ export const Search: FC = () => {
bg: 'primary',
svg: { color: 'bg' }
}}
+ aria-label="Search"
>
diff --git a/src/components/layouts/Footer.tsx b/src/components/layouts/Footer.tsx
index e230636cba..9410a43939 100644
--- a/src/components/layouts/Footer.tsx
+++ b/src/components/layouts/Footer.tsx
@@ -80,7 +80,7 @@ export const Footer: FC = () => {
_hover={hoverStyles}
>
-
+
@@ -93,13 +93,13 @@ export const Footer: FC = () => {
borderColor='primary'
>
-
+
-
+
diff --git a/src/components/layouts/MobileMenu.tsx b/src/components/layouts/MobileMenu.tsx
index 8dbc08e324..ca52635532 100644
--- a/src/components/layouts/MobileMenu.tsx
+++ b/src/components/layouts/MobileMenu.tsx
@@ -20,6 +20,7 @@ export const MobileMenu: React.FC = () => {
color='primary'
_hover={{ bg: 'primary', color: 'bg' }}
onClick={onOpen}
+ aria-label="Open mobile menu"
>
diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx
index 86380e3a38..87047ee0ad 100644
--- a/src/pages/[...slug].tsx
+++ b/src/pages/[...slug].tsx
@@ -104,7 +104,7 @@ const DocPage: NextPage = ({ frontmatter, content, navLinks, lastModified
-
+
diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx
index 9a0ff9aa9e..83030e64c9 100644
--- a/src/pages/_document.tsx
+++ b/src/pages/_document.tsx
@@ -2,7 +2,7 @@ import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() {
return (
-
+
{/* fonts are being loaded here to enable optimization (https://nextjs.org/docs/basic-features/font-optimization) */}
{/* JetBrains Mono */}
diff --git a/src/pages/downloads.tsx b/src/pages/downloads.tsx
index 720f3020ed..a688abf8b5 100644
--- a/src/pages/downloads.tsx
+++ b/src/pages/downloads.tsx
@@ -298,7 +298,7 @@ const DownloadsPage: NextPage = ({ data }) => {
<>
-
+
{
<>
-
+
@@ -44,7 +44,7 @@ const HomePage: NextPage = ({}) => {
>
Geth (go-ethereum) is a{' '}
-
+
Go
{' '}
implementation of{' '}