fix(a11y): WCAG 2.1 AA fixes (#2219)
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user