Fix accessibility issues reported by PageSpeed tests (#41)

* Set aria-label on all buttons

* Use a <p> instead of <h4> in footer
This commit is contained in:
Samy Pessé
2023-12-18 12:31:56 +01:00
committed by GitHub
parent 705ea6c997
commit fc68dbdd4e
7 changed files with 24 additions and 4 deletions
@@ -2,6 +2,7 @@
import React from 'react';
import { t, useLanguage } from '@/intl/client';
import { ClassValue, tcls } from '@/lib/tailwind';
/**
@@ -11,6 +12,7 @@ import { ClassValue, tcls } from '@/lib/tailwind';
export function CopyCodeButton(props: { codeId: string; style: ClassValue }) {
const { codeId, style } = props;
const language = useLanguage();
const [copied, setCopied] = React.useState(false);
React.useEffect(() => {
@@ -40,7 +42,7 @@ export function CopyCodeButton(props: { codeId: string; style: ClassValue }) {
return (
<button onClick={onClick} className={tcls(style)}>
{copied ? 'Copied!' : 'Copy'}
{t(language, copied ? 'code_copied' : 'code_copy')}
</button>
);
}