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
pull/26459/head^2
Paul Wackerow 2 years ago committed by GitHub
parent 82fdd696a2
commit 266b4a3ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      src/components/UI/Header.tsx
  2. 4
      src/components/UI/docs/DocsNav.tsx
  3. 4
      src/components/UI/docs/DocumentNav.tsx
  4. 1
      src/components/UI/search/Search.tsx
  5. 6
      src/components/layouts/Footer.tsx
  6. 1
      src/components/layouts/MobileMenu.tsx
  7. 2
      src/pages/[...slug].tsx
  8. 2
      src/pages/_document.tsx
  9. 2
      src/pages/downloads.tsx
  10. 4
      src/pages/index.tsx

@ -19,13 +19,14 @@ export const Header: FC = () => {
justifyContent='space-between' justifyContent='space-between'
position='relative' position='relative'
> >
<Stack <Flex
p={4} p={4}
justifyContent='center' justifyContent='flex-start'
alignItems='flex-start' alignItems='center'
borderRight='2px' borderRight='2px'
borderColor='primary' borderColor='primary'
flexGrow={2} flex={1}
gap={6}
> >
<NextLink href={'/'} passHref legacyBehavior> <NextLink href={'/'} passHref legacyBehavior>
<Link _hover={{ textDecoration: 'none' }}> <Link _hover={{ textDecoration: 'none' }}>
@ -34,7 +35,22 @@ export const Header: FC = () => {
</Text> </Text>
</Link> </Link>
</NextLink> </NextLink>
</Stack> <Box
as='a'
href='#main-content'
pointerEvents='none'
opacity={0}
transition='opacity 200ms ease-in-out'
_focus={{
opacity: 1,
transition: 'opacity 200ms ease-in-out'
}}
>
<Text textStyle='header-font' whiteSpace='nowrap' fontSize='xs'>
skip to content
</Text>
</Box>
</Flex>
<Flex> <Flex>
{/* HEADER BUTTONS */} {/* HEADER BUTTONS */}
@ -58,6 +74,7 @@ export const Header: FC = () => {
bg: 'primary', bg: 'primary',
svg: { color: 'bg' } svg: { color: 'bg' }
}} }}
aria-label={`Toggle ${isDark ? 'light' : 'dark'} mode`}
> >
{isDark ? <SunIcon color='primary' /> : <MoonIcon color='primary' />} {isDark ? <SunIcon color='primary' /> : <MoonIcon color='primary' />}
</Box> </Box>

@ -24,7 +24,7 @@ export const DocsNav: FC<Props> = ({ navLinks }) => {
} }
return ( return (
<Stack w={{ base: '100%', lg: 72 }}> <Stack w={{ base: '100%', lg: 72 }} as='aside'>
<Stack display={{ base: 'none', lg: 'block' }}> <Stack display={{ base: 'none', lg: 'block' }}>
<DocsLinks navLinks={navLinks} toggleMobileAccordion={toggleMobileAccordion} /> <DocsLinks navLinks={navLinks} toggleMobileAccordion={toggleMobileAccordion} />
</Stack> </Stack>
@ -49,7 +49,7 @@ export const DocsNav: FC<Props> = ({ navLinks }) => {
color: 'bg' color: 'bg'
}} }}
> >
<Text as='h4' textStyle='docs-nav-dropdown'> <Text textStyle='docs-nav-dropdown' >
Documentation Documentation
</Text> </Text>
<AccordionIcon /> <AccordionIcon />

@ -20,8 +20,8 @@ export const DocumentNav: FC<Props> = ({ content }) => {
const activeHash = useActiveHash(parsedHeadings.map(heading => heading!.headingId)); const activeHash = useActiveHash(parsedHeadings.map(heading => heading!.headingId));
return ( return (
<Box position='sticky' top='4'> <Box as='aside' position='sticky' top='4'>
<Text as='h5' textStyle='document-nav-title'> <Text textStyle='document-nav-title'>
on this page on this page
</Text> </Text>
<Divider borderColor='primary' my={`4 !important`} /> <Divider borderColor='primary' my={`4 !important`} />

@ -49,6 +49,7 @@ export const Search: FC = () => {
bg: 'primary', bg: 'primary',
svg: { color: 'bg' } svg: { color: 'bg' }
}} }}
aria-label="Search"
> >
<LensIcon color={{ base: 'bg', md: 'primary' }} fontSize={{ base: '3xl', md: 'xl' }} /> <LensIcon color={{ base: 'bg', md: 'primary' }} fontSize={{ base: '3xl', md: 'xl' }} />
</Button> </Button>

@ -80,7 +80,7 @@ export const Footer: FC = () => {
_hover={hoverStyles} _hover={hoverStyles}
> >
<Link href={GETH_TWITTER_URL} isExternal p={4}> <Link href={GETH_TWITTER_URL} isExternal p={4}>
<TwitterIcon w={8} height='22px' _groupHover={{ color: 'bg' }} color='primary' /> <TwitterIcon w={8} height='22px' _groupHover={{ color: 'bg' }} color='primary' aria-label='Twitter' />
</Link> </Link>
</Center> </Center>
@ -93,13 +93,13 @@ export const Footer: FC = () => {
borderColor='primary' borderColor='primary'
> >
<Link href={GETH_DISCORD_URL} isExternal p={4}> <Link href={GETH_DISCORD_URL} isExternal p={4}>
<DiscordIcon w={8} height='22px' _groupHover={{ color: 'bg' }} color='primary' /> <DiscordIcon w={8} height='22px' _groupHover={{ color: 'bg' }} color='primary' aria-label='Discord' />
</Link> </Link>
</Center> </Center>
<Center data-group flex={1} _hover={hoverStyles}> <Center data-group flex={1} _hover={hoverStyles}>
<Link href={GETH_REPO_URL} isExternal p={4}> <Link href={GETH_REPO_URL} isExternal p={4}>
<GitHubIcon w={7} height='22px' _groupHover={{ color: 'bg' }} color='primary' /> <GitHubIcon w={7} height='22px' _groupHover={{ color: 'bg' }} color='primary' aria-label='GitHub' />
</Link> </Link>
</Center> </Center>
</Flex> </Flex>

@ -20,6 +20,7 @@ export const MobileMenu: React.FC = () => {
color='primary' color='primary'
_hover={{ bg: 'primary', color: 'bg' }} _hover={{ bg: 'primary', color: 'bg' }}
onClick={onOpen} onClick={onOpen}
aria-label="Open mobile menu"
> >
<HamburgerIcon /> <HamburgerIcon />
</Box> </Box>

@ -104,7 +104,7 @@ const DocPage: NextPage<Props> = ({ frontmatter, content, navLinks, lastModified
<DocsNav navLinks={navLinks} /> <DocsNav navLinks={navLinks} />
</Stack> </Stack>
<Stack pb={4} width='100%'> <Stack pb={4} width='100%' id="main-content">
<Stack mb={16}> <Stack mb={16}>
<Breadcrumbs /> <Breadcrumbs />
<Heading as='h1' mt='4 !important' mb={0} {...textStyles.header1}> <Heading as='h1' mt='4 !important' mb={0} {...textStyles.header1}>

@ -2,7 +2,7 @@ import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() { export default function Document() {
return ( return (
<Html> <Html lang='en'>
<Head> <Head>
{/* fonts are being loaded here to enable optimization (https://nextjs.org/docs/basic-features/font-optimization) */} {/* fonts are being loaded here to enable optimization (https://nextjs.org/docs/basic-features/font-optimization) */}
{/* JetBrains Mono */} {/* JetBrains Mono */}

@ -298,7 +298,7 @@ const DownloadsPage: NextPage<Props> = ({ data }) => {
<> <>
<PageMetadata title={METADATA.DOWNLOADS_TITLE} description={METADATA.DOWNLOADS_DESCRIPTION} /> <PageMetadata title={METADATA.DOWNLOADS_TITLE} description={METADATA.DOWNLOADS_DESCRIPTION} />
<main> <main id="main-content">
<Stack spacing={4}> <Stack spacing={4}>
<DownloadsHero <DownloadsHero
currentBuild={LATEST_RELEASES_DATA.releaseName} currentBuild={LATEST_RELEASES_DATA.releaseName}

@ -28,7 +28,7 @@ const HomePage: NextPage = ({}) => {
<> <>
<PageMetadata title={METADATA.HOME_TITLE} description={METADATA.HOME_DESCRIPTION} /> <PageMetadata title={METADATA.HOME_TITLE} description={METADATA.HOME_DESCRIPTION} />
<main> <main id="main-content">
<Stack spacing={4}> <Stack spacing={4}>
<HomeHero /> <HomeHero />
@ -44,7 +44,7 @@ const HomePage: NextPage = ({}) => {
> >
<Text textStyle='quick-link-text'> <Text textStyle='quick-link-text'>
Geth (go-ethereum) is a{' '} Geth (go-ethereum) is a{' '}
<Link href={GO_URL} isExternal variant='light'> <Link href={GO_URL} isExternal variant='light' aria-label='Go lang'>
Go Go
</Link>{' '} </Link>{' '}
implementation of{' '} implementation of{' '}

Loading…
Cancel
Save