From fc68dbdd4e863dd090e3104f841824f0308c7f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 18 Dec 2023 12:31:56 +0100 Subject: [PATCH] Fix accessibility issues reported by PageSpeed tests (#41) * Set aria-label on all buttons * Use a

instead of

in footer --- .../DocumentView/Annotation/AnnotationPopover.tsx | 3 +++ src/components/DocumentView/CodeBlock/CopyCodeButton.tsx | 4 +++- src/components/Footer/FooterLinksGroup.tsx | 2 +- src/components/Header/HeaderMobileMenu.tsx | 9 ++++++++- src/components/PageFeedback/PageFeedbackForm.tsx | 1 + src/components/Search/SearchButton.tsx | 3 +++ src/intl/translations/en.json | 6 +++++- 7 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/DocumentView/Annotation/AnnotationPopover.tsx b/src/components/DocumentView/Annotation/AnnotationPopover.tsx index d95dbe85a..3b7154ff5 100644 --- a/src/components/DocumentView/Annotation/AnnotationPopover.tsx +++ b/src/components/DocumentView/Annotation/AnnotationPopover.tsx @@ -3,15 +3,18 @@ import * as Popover from '@radix-ui/react-popover'; import React from 'react'; +import { useLanguage, tString } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; export function AnnotationPopover(props: { children: React.ReactNode; body: React.ReactNode }) { const { children, body } = props; + const language = useLanguage(); return ( ); } diff --git a/src/components/Footer/FooterLinksGroup.tsx b/src/components/Footer/FooterLinksGroup.tsx index db2c41779..5f23517fd 100644 --- a/src/components/Footer/FooterLinksGroup.tsx +++ b/src/components/Footer/FooterLinksGroup.tsx @@ -12,7 +12,7 @@ export function FooterLinksGroup(props: { return (
-

{group.title}

+

{group.title}

{group.links.map((link, index) => { return ; })} diff --git a/src/components/Header/HeaderMobileMenu.tsx b/src/components/Header/HeaderMobileMenu.tsx index db04ae6f0..378312c6c 100644 --- a/src/components/Header/HeaderMobileMenu.tsx +++ b/src/components/Header/HeaderMobileMenu.tsx @@ -1,9 +1,12 @@ 'use client'; import { IconMenu } from '@/components/icons/IconMenu'; +import { useLanguage, tString } from '@/intl/client'; import { tcls } from '@/lib/tailwind'; export function HeaderMobileMenu(props: Partial>) { + const language = useLanguage(); + const toggleNavigation = () => { if (document.body.classList.contains('navigation-visible')) { document.body.classList.remove('navigation-visible'); @@ -12,7 +15,11 @@ export function HeaderMobileMenu(props: Partial +