fix(a11y): WCAG 2.1 AA fixes (#2219)

This commit is contained in:
Philip Okugbe
2026-05-20 16:47:25 +01:00
committed by GitHub
parent 1c166c4736
commit 92c0e36e46
119 changed files with 1064 additions and 194 deletions

View File

@@ -36,7 +36,13 @@ export default function ChangeEmail() {
</Button>
*/}
<Modal opened={opened} onClose={close} title={t("Change email")} centered>
<Modal
opened={opened}
onClose={close}
title={t("Change email")}
centered
closeButtonProps={{ "aria-label": t("Close") }}
>
<Text mb="md">
{t(
"To change your email, you have to enter your password and new email.",
@@ -80,6 +86,11 @@ function ChangeEmailForm() {
placeholder={t("Enter your password")}
variant="filled"
mb="md"
visibilityToggleButtonProps={{
"aria-label": t("Toggle password visibility"),
"aria-hidden": false,
tabIndex: 0,
}}
{...form.getInputProps("password")}
/>

View File

@@ -95,6 +95,11 @@ function ChangePasswordForm({ onClose }: ChangePasswordFormProps) {
variant="filled"
mb="md"
data-autofocus
visibilityToggleButtonProps={{
"aria-label": t("Toggle password visibility"),
"aria-hidden": false,
tabIndex: 0,
}}
{...form.getInputProps("oldPassword")}
/>
@@ -103,6 +108,11 @@ function ChangePasswordForm({ onClose }: ChangePasswordFormProps) {
placeholder={t("Enter your new password")}
variant="filled"
mb="md"
visibilityToggleButtonProps={{
"aria-label": t("Toggle password visibility"),
"aria-hidden": false,
tabIndex: 0,
}}
{...form.getInputProps("newPassword")}
/>

View File

@@ -3,7 +3,7 @@ import { updateUser } from "@/features/user/services/user-service.ts";
import { IUser, IUserSettings } from "@/features/user/types/user.types.ts";
import { Switch, Text, Title, Stack } from "@mantine/core";
import { useAtom } from "jotai";
import React, { useState } from "react";
import React, { useId, useState } from "react";
import { useTranslation } from "react-i18next";
import {
ResponsiveSettingsRow,
@@ -64,6 +64,8 @@ function NotificationToggle({
description: string;
}) {
const { t } = useTranslation();
const switchId = useId();
const descriptionId = useId();
const [user, setUser] = useAtom(userAtom);
const [checked, setChecked] = useState(
user.settings?.notifications?.[settingKey] !== false,
@@ -83,14 +85,21 @@ function NotificationToggle({
return (
<ResponsiveSettingsRow>
<ResponsiveSettingsContent>
<Text size="md">{t(label)}</Text>
<Text size="sm" c="dimmed">
<Text component="label" htmlFor={switchId} size="md" style={{ cursor: "pointer" }}>
{t(label)}
</Text>
<Text id={descriptionId} size="sm" c="dimmed">
{t(description)}
</Text>
</ResponsiveSettingsContent>
<ResponsiveSettingsControl>
<Switch checked={checked} onChange={handleChange} />
<Switch
id={switchId}
checked={checked}
onChange={handleChange}
aria-describedby={descriptionId}
/>
</ResponsiveSettingsControl>
</ResponsiveSettingsRow>
);
@@ -101,7 +110,7 @@ export default function NotificationPref() {
return (
<Stack gap="xs">
<Title order={5}>{t("Email notifications")}</Title>
<Title order={2} size="h5">{t("Email notifications")}</Title>
{notificationItems.map((item) => (
<NotificationToggle