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

@@ -19,6 +19,7 @@ interface CommentEditorProps {
editable: boolean;
placeholder?: string;
autofocus?: boolean;
surface?: "default" | "muted";
}
const CommentEditor = forwardRef(
@@ -30,6 +31,7 @@ const CommentEditor = forwardRef(
editable,
placeholder,
autofocus,
surface,
}: CommentEditorProps,
ref,
) => {
@@ -66,6 +68,9 @@ const CommentEditor = forwardRef(
}),
],
editorProps: {
attributes: {
"aria-label": placeholder || t("Comment"),
},
handleDOMEvents: {
keydown: (_view, event) => {
if (
@@ -131,6 +136,7 @@ const CommentEditor = forwardRef(
ref={focusRef}
className={classes.commentEditor}
data-editable={editable || undefined}
data-surface={surface}
>
<EditorContent
editor={commentEditor}

View File

@@ -383,6 +383,7 @@ const PageCommentInput = ({ onSave, isLoading }) => {
onSave={handleSave}
editable={true}
placeholder={t("Add a comment...")}
surface="muted"
/>
</div>
</Group>
@@ -391,6 +392,7 @@ const PageCommentInput = ({ onSave, isLoading }) => {
variant="filled"
radius="xl"
size="sm"
aria-label={t("Send comment")}
onClick={handleSave}
onMouseDown={(e) => e.preventDefault()}
loading={isLoading}

View File

@@ -22,6 +22,11 @@
.commentEditor {
&[data-editable][data-surface="muted"] .ProseMirror:not(.focused) {
border-radius: var(--mantine-radius-sm);
box-shadow: 0 0 0 1px light-dark(var(--mantine-color-gray-5), var(--mantine-color-dark-4));
}
.focused {
border-radius: var(--mantine-radius-sm);
box-shadow: 0 0 0 2px var(--mantine-color-blue-3);