mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
aria fixes
This commit is contained in:
@@ -80,6 +80,12 @@ export default function AvatarUploader({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ariaLabel = {
|
||||||
|
[AvatarIconType.AVATAR]: t("Change avatar"),
|
||||||
|
[AvatarIconType.SPACE_ICON]: t("Change space icon"),
|
||||||
|
[AvatarIconType.WORKSPACE_ICON]: t("Change workspace icon"),
|
||||||
|
}[type];
|
||||||
|
|
||||||
const handleRemove = async () => {
|
const handleRemove = async () => {
|
||||||
if (disabled) return;
|
if (disabled) return;
|
||||||
|
|
||||||
@@ -104,6 +110,8 @@ export default function AvatarUploader({
|
|||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
onChange={handleFileInputChange}
|
onChange={handleFileInputChange}
|
||||||
accept="image/png,image/jpeg,image/jpg"
|
accept="image/png,image/jpeg,image/jpg"
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
tabIndex={-1}
|
||||||
style={{ display: "none" }}
|
style={{ display: "none" }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -115,6 +123,8 @@ export default function AvatarUploader({
|
|||||||
size={size}
|
size={size}
|
||||||
avatarUrl={currentImageUrl}
|
avatarUrl={currentImageUrl}
|
||||||
name={fallbackName}
|
name={fallbackName}
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
aria-haspopup="menu"
|
||||||
style={{
|
style={{
|
||||||
cursor: disabled || isLoading ? "default" : "pointer",
|
cursor: disabled || isLoading ? "default" : "pointer",
|
||||||
opacity: isLoading ? 0.6 : 1,
|
opacity: isLoading ? 0.6 : 1,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
Badge,
|
Badge,
|
||||||
Table,
|
Table,
|
||||||
ActionIcon,
|
ThemeIcon,
|
||||||
Button,
|
Button,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -49,9 +49,9 @@ export default function RecentChanges({ spaceId }: Props) {
|
|||||||
>
|
>
|
||||||
<Group wrap="nowrap">
|
<Group wrap="nowrap">
|
||||||
{page.icon || (
|
{page.icon || (
|
||||||
<ActionIcon variant="transparent" color="gray" size={18}>
|
<ThemeIcon variant="transparent" color="gray" size={18}>
|
||||||
<IconFileDescription size={18} />
|
<IconFileDescription size={18} />
|
||||||
</ActionIcon>
|
</ThemeIcon>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Text fw={500} size="md" lineClamp={1}>
|
<Text fw={500} size="md" lineClamp={1}>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { ActionIcon, rem } from "@mantine/core";
|
import { ThemeIcon } from "@mantine/core";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { IconUsersGroup } from "@tabler/icons-react";
|
import { IconUsersGroup } from "@tabler/icons-react";
|
||||||
|
|
||||||
export function IconGroupCircle() {
|
export function IconGroupCircle() {
|
||||||
return (
|
return (
|
||||||
<ActionIcon variant="light" size="lg" color="gray" radius="xl">
|
<ThemeIcon variant="light" size="lg" color="gray" radius="xl">
|
||||||
<IconUsersGroup stroke={1.5} />
|
<IconUsersGroup stroke={1.5} />
|
||||||
</ActionIcon>
|
</ThemeIcon>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ export default function SsoProviderList() {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
color="gray"
|
color="gray"
|
||||||
|
aria-label={t("Edit {{name}}", { name: provider.name })}
|
||||||
onClick={() => handleEdit(provider)}
|
onClick={() => handleEdit(provider)}
|
||||||
>
|
>
|
||||||
<IconPencil size={16} />
|
<IconPencil size={16} />
|
||||||
@@ -152,7 +153,13 @@ export default function SsoProviderList() {
|
|||||||
withinPortal
|
withinPortal
|
||||||
>
|
>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
<ActionIcon variant="subtle" color="gray">
|
<ActionIcon
|
||||||
|
variant="subtle"
|
||||||
|
color="gray"
|
||||||
|
aria-label={t("More actions for {{name}}", {
|
||||||
|
name: provider.name,
|
||||||
|
})}
|
||||||
|
>
|
||||||
<IconDots size={16} />
|
<IconDots size={16} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
|
|||||||
@@ -53,15 +53,17 @@ export default function StarButton(props: StarButtonProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const label = isFavorited
|
||||||
|
? t("Remove from favorites")
|
||||||
|
: t("Add to favorites");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip label={label} openDelay={250} withArrow>
|
||||||
label={isFavorited ? t("Remove from favorites") : t("Add to favorites")}
|
|
||||||
openDelay={250}
|
|
||||||
withArrow
|
|
||||||
>
|
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
color={isFavorited ? "yellow" : "gray"}
|
color={isFavorited ? "yellow" : "gray"}
|
||||||
|
aria-label={label}
|
||||||
|
aria-pressed={isFavorited}
|
||||||
onClick={handleToggle}
|
onClick={handleToggle}
|
||||||
loading={isPending}
|
loading={isPending}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
Badge,
|
Badge,
|
||||||
Table,
|
Table,
|
||||||
ActionIcon,
|
ThemeIcon,
|
||||||
Button,
|
Button,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -61,13 +61,13 @@ export default function CreatedByMe({ spaceId }: Props) {
|
|||||||
>
|
>
|
||||||
<Group wrap="nowrap">
|
<Group wrap="nowrap">
|
||||||
{page.icon || (
|
{page.icon || (
|
||||||
<ActionIcon
|
<ThemeIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
color="gray"
|
color="gray"
|
||||||
size={18}
|
size={18}
|
||||||
>
|
>
|
||||||
<IconFileDescription size={18} />
|
<IconFileDescription size={18} />
|
||||||
</ActionIcon>
|
</ThemeIcon>
|
||||||
)}
|
)}
|
||||||
<Text fw={500} size="md" lineClamp={1}>
|
<Text fw={500} size="md" lineClamp={1}>
|
||||||
{page.title || t("Untitled")}
|
{page.title || t("Untitled")}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
Badge,
|
Badge,
|
||||||
Table,
|
Table,
|
||||||
ActionIcon,
|
ThemeIcon,
|
||||||
Button,
|
Button,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -62,13 +62,13 @@ export default function FavoritesPages({ spaceId }: Props) {
|
|||||||
>
|
>
|
||||||
<Group wrap="nowrap">
|
<Group wrap="nowrap">
|
||||||
{fav.page.icon || (
|
{fav.page.icon || (
|
||||||
<ActionIcon
|
<ThemeIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
color="gray"
|
color="gray"
|
||||||
size={18}
|
size={18}
|
||||||
>
|
>
|
||||||
<IconFileDescription size={18} />
|
<IconFileDescription size={18} />
|
||||||
</ActionIcon>
|
</ThemeIcon>
|
||||||
)}
|
)}
|
||||||
<Text fw={500} size="md" lineClamp={1}>
|
<Text fw={500} size="md" lineClamp={1}>
|
||||||
{fav.page.title || t("Untitled")}
|
{fav.page.title || t("Untitled")}
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ export function NotificationPopover() {
|
|||||||
variant="subtle"
|
variant="subtle"
|
||||||
color="dark"
|
color="dark"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
aria-label={t("Notifications")}
|
||||||
|
aria-haspopup="dialog"
|
||||||
|
aria-expanded={opened}
|
||||||
onClick={() => setOpened((o) => !o)}
|
onClick={() => setOpened((o) => !o)}
|
||||||
>
|
>
|
||||||
<Indicator
|
<Indicator
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ActionIcon, Group, Menu, Text, Tooltip } from "@mantine/core";
|
import { ActionIcon, Group, Menu, Text, ThemeIcon, Tooltip } from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
IconArrowRight,
|
IconArrowRight,
|
||||||
IconArrowsHorizontal,
|
IconArrowsHorizontal,
|
||||||
@@ -99,6 +99,7 @@ export default function PageHeaderMenu({ readOnly }: PageHeaderMenuProps) {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
color="dark"
|
color="dark"
|
||||||
|
aria-label={t("Comments")}
|
||||||
onClick={() => toggleAside("comments")}
|
onClick={() => toggleAside("comments")}
|
||||||
>
|
>
|
||||||
<IconMessage size={20} stroke={2} />
|
<IconMessage size={20} stroke={2} />
|
||||||
@@ -109,6 +110,7 @@ export default function PageHeaderMenu({ readOnly }: PageHeaderMenuProps) {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
color="dark"
|
color="dark"
|
||||||
|
aria-label={t("Table of contents")}
|
||||||
onClick={() => toggleAside("toc")}
|
onClick={() => toggleAside("toc")}
|
||||||
>
|
>
|
||||||
<IconList size={20} stroke={2} />
|
<IconList size={20} stroke={2} />
|
||||||
@@ -420,9 +422,15 @@ function ConnectionWarning() {
|
|||||||
openDelay={250}
|
openDelay={250}
|
||||||
withArrow
|
withArrow
|
||||||
>
|
>
|
||||||
<ActionIcon variant="default" c="red" style={{ border: "none" }}>
|
<ThemeIcon
|
||||||
|
variant="default"
|
||||||
|
c="red"
|
||||||
|
role="status"
|
||||||
|
aria-label={t("Real-time editor connection lost. Retrying...")}
|
||||||
|
style={{ border: "none" }}
|
||||||
|
>
|
||||||
<IconWifiOff size={20} stroke={2} />
|
<IconWifiOff size={20} stroke={2} />
|
||||||
</ActionIcon>
|
</ThemeIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,15 +49,15 @@ function WatchButton({ spaceId, watchedIds, size = 16 }: { spaceId: string; watc
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const label = isWatching ? t("Stop watching space") : t("Watch space");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip label={label} openDelay={250} withArrow>
|
||||||
label={isWatching ? t("Stop watching space") : t("Watch space")}
|
|
||||||
openDelay={250}
|
|
||||||
withArrow
|
|
||||||
>
|
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
color={isWatching ? "blue" : "gray"}
|
color={isWatching ? "blue" : "gray"}
|
||||||
|
aria-label={label}
|
||||||
|
aria-pressed={isWatching}
|
||||||
onClick={handleToggle}
|
onClick={handleToggle}
|
||||||
loading={isPending}
|
loading={isPending}
|
||||||
>
|
>
|
||||||
|
|||||||
+5
-1
@@ -83,7 +83,11 @@ export default function MemberActionMenu({ userId, deactivatedAt }: Props) {
|
|||||||
arrowPosition="center"
|
arrowPosition="center"
|
||||||
>
|
>
|
||||||
<Menu.Target>
|
<Menu.Target>
|
||||||
<ActionIcon variant="subtle" c="gray">
|
<ActionIcon
|
||||||
|
variant="subtle"
|
||||||
|
c="gray"
|
||||||
|
aria-label={t("Member actions")}
|
||||||
|
>
|
||||||
<IconDots size={20} stroke={2} />
|
<IconDots size={20} stroke={2} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
|
|||||||
Reference in New Issue
Block a user