feat(client): improve accessibility with ARIA labels and semantics

- Add aria-label to icon-only ActionIcon triggers across tree, comments,
  share, group, breadcrumbs, templates, AI chat, API keys, and spaces
- Give custom clickable divs/spans (color swatches, status swatches,
  load-more, PDF error, comment selection) role="button", tabIndex,
  and keyboard handlers
- Add listbox/combobox semantics (role, aria-selected, aria-activedescendant)
  to slash menu, emoji menu, mention list, and link editor results
- Add aria-haspopup/aria-expanded to bubble-menu triggers (node, text
  align, color) and status badge
- Add aria-label to Modal.Root/Dialog instances that lack a title prop
  (page history, template preview, trash preview, drawio, comment,
  find-and-replace, page verification)
- Add en-US translations for new aria-label strings
This commit is contained in:
Philipinho
2026-04-18 13:07:16 +01:00
parent dba8e315ab
commit fadeeaa59d
32 changed files with 274 additions and 52 deletions
@@ -880,5 +880,24 @@
"Try a different search term.": "Try a different search term.", "Try a different search term.": "Try a different search term.",
"Try again": "Try again", "Try again": "Try again",
"Untitled chat": "Untitled chat", "Untitled chat": "Untitled chat",
"What can I help you with?": "What can I help you with?" "What can I help you with?": "What can I help you with?",
"Page menu": "Page menu",
"Expand": "Expand",
"Collapse": "Collapse",
"Comment menu": "Comment menu",
"Group menu": "Group menu",
"Show hidden breadcrumbs": "Show hidden breadcrumbs",
"Breadcrumbs": "Breadcrumbs",
"Page actions": "Page actions",
"Pick emoji": "Pick emoji",
"Template menu": "Template menu",
"Chat menu": "Chat menu",
"API key menu": "API key menu",
"Jump to comment selection": "Jump to comment selection",
"Slash commands": "Slash commands",
"Mention suggestions": "Mention suggestions",
"Link suggestions": "Link suggestions",
"Diagram editor": "Diagram editor",
"Add comment": "Add comment",
"Find and replace": "Find and replace"
} }
@@ -25,6 +25,7 @@ export default function CopyTextButton({ text, size }: CopyProps) {
variant="subtle" variant="subtle"
onClick={copy} onClick={copy}
size={size} size={size}
aria-label={copied ? t("Copied") : t("Copy")}
> >
{copied ? <IconCheck size={16} /> : <IconCopy size={16} />} {copied ? <IconCheck size={16} /> : <IconCopy size={16} />}
</ActionIcon> </ActionIcon>
@@ -74,7 +74,18 @@ export function PageChildren({
/> />
))} ))}
{hasNextPage && ( {hasNextPage && (
<div className={classes.loadMore} onClick={() => fetchNextPage()}> <div
className={classes.loadMore}
onClick={() => fetchNextPage()}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
fetchNextPage();
}
}}
role="button"
tabIndex={0}
>
{t("Load more")} {t("Load more")}
</div> </div>
)} )}
@@ -75,6 +75,9 @@ function EmojiPicker({
variant={actionIconProps?.variant || "transparent"} variant={actionIconProps?.variant || "transparent"}
size={actionIconProps?.size} size={actionIconProps?.size}
onClick={handlers.toggle} onClick={handlers.toggle}
aria-label={t("Pick emoji")}
aria-haspopup="dialog"
aria-expanded={opened}
> >
{icon} {icon}
</ActionIcon> </ActionIcon>
@@ -132,6 +132,7 @@ export default function AiChatSidebarItem({
size="xs" size="xs"
color="gray" color="gray"
onClick={(e) => e.preventDefault()} onClick={(e) => e.preventDefault()}
aria-label={t("Chat menu")}
> >
<IconDots size={14} /> <IconDots size={14} />
</ActionIcon> </ActionIcon>
@@ -106,7 +106,11 @@ export function ApiKeyTable({
<Table.Td> <Table.Td>
<Menu position="bottom-end" withinPortal> <Menu position="bottom-end" withinPortal>
<Menu.Target> <Menu.Target>
<ActionIcon variant="subtle" color="gray"> <ActionIcon
variant="subtle"
color="gray"
aria-label={t("API key menu")}
>
<IconDots size={16} /> <IconDots size={16} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>
@@ -38,6 +38,7 @@ export function PageVerificationModal({
<Modal <Modal
opened={opened} opened={opened}
onClose={onClose} onClose={onClose}
aria-label={status === "none" ? t("Set up verification") : t("Verify page")}
title={ title={
<Group gap="xs"> <Group gap="xs">
<IconShieldCheck <IconShieldCheck
@@ -56,6 +56,7 @@ export default function TemplateCard({
color="gray" color="gray"
className={classes.menuTarget} className={classes.menuTarget}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
aria-label={t("Template menu")}
> >
<IconDots size={16} /> <IconDots size={16} />
</ActionIcon> </ActionIcon>
@@ -24,7 +24,7 @@ export default function TemplatePreviewModal({
const title = template?.title || t("Untitled"); const title = template?.title || t("Untitled");
return ( return (
<Modal.Root size={1200} opened={opened} onClose={onClose}> <Modal.Root size={1200} opened={opened} onClose={onClose} aria-label={title}>
<Modal.Overlay /> <Modal.Overlay />
<Modal.Content style={{ overflow: "hidden" }}> <Modal.Content style={{ overflow: "hidden" }}>
<Modal.Header> <Modal.Header>
@@ -144,6 +144,7 @@ function CommentDialog({ editor, pageId, readOnly }: CommentDialogProps) {
withCloseButton withCloseButton
withBorder withBorder
data-comment-dialog data-comment-dialog
aria-label={t("Add comment")}
> >
<Stack gap={2}> <Stack gap={2}>
<Group> <Group>
@@ -173,6 +173,15 @@ function CommentListItem({
<Box <Box
className={classes.textSelection} className={classes.textSelection}
onClick={() => handleCommentClick(comment)} onClick={() => handleCommentClick(comment)}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleCommentClick(comment);
}
}}
role="button"
tabIndex={0}
aria-label={t("Jump to comment selection")}
> >
<Text size="sm">{comment?.selection}</Text> <Text size="sm">{comment?.selection}</Text>
</Box> </Box>
@@ -46,7 +46,11 @@ function CommentMenu({
return ( return (
<Menu shadow="md" width={200}> <Menu shadow="md" width={200}>
<Menu.Target> <Menu.Target>
<ActionIcon variant="default" style={{ border: "none" }}> <ActionIcon
variant="default"
style={{ border: "none" }}
aria-label={t("Comment menu")}
>
<IconDots size={20} stroke={2} /> <IconDots size={20} stroke={2} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>
@@ -172,6 +172,9 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
fontWeight: 500, fontWeight: 500,
fontSize: rem(16), fontSize: rem(16),
}} }}
aria-label={t("Text color")}
aria-haspopup="dialog"
aria-expanded={isOpen}
> >
A A
</Button> </Button>
@@ -186,10 +189,8 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
{t("Text color")} {t("Text color")}
</Text> </Text>
<SimpleGrid cols={5} spacing="xs"> <SimpleGrid cols={5} spacing="xs">
{TEXT_COLORS.map(({ name, color }, index) => ( {TEXT_COLORS.map(({ name, color }, index) => {
<Tooltip key={index} label={t(name)} withArrow> const applyTextColor = () => {
<Box
onClick={() => {
if (name === "Default") { if (name === "Default") {
editor.commands.unsetColor(); editor.commands.unsetColor();
} else { } else {
@@ -200,6 +201,20 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
.run(); .run();
} }
setIsOpen(false); setIsOpen(false);
};
return (
<Tooltip key={index} label={t(name)} withArrow>
<Box
role="button"
tabIndex={0}
aria-label={t(name)}
aria-pressed={!!editorState[`text_${color}`]}
onClick={applyTextColor}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
applyTextColor();
}
}} }}
style={{ style={{
width: rem(28), width: rem(28),
@@ -221,7 +236,8 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
A A
</Box> </Box>
</Tooltip> </Tooltip>
))} );
})}
</SimpleGrid> </SimpleGrid>
</Box> </Box>
@@ -230,10 +246,8 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
{t("Highlight color")} {t("Highlight color")}
</Text> </Text>
<SimpleGrid cols={5} spacing="xs"> <SimpleGrid cols={5} spacing="xs">
{HIGHLIGHT_COLORS.map(({ name, color }, index) => ( {HIGHLIGHT_COLORS.map(({ name, color }, index) => {
<Tooltip key={index} label={t(name)} withArrow> const applyHighlight = () => {
<Box
onClick={() => {
if (name === "Default") { if (name === "Default") {
editor.commands.unsetHighlight(); editor.commands.unsetHighlight();
} else { } else {
@@ -247,6 +261,20 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
.run(); .run();
} }
setIsOpen(false); setIsOpen(false);
};
return (
<Tooltip key={index} label={t(name)} withArrow>
<Box
role="button"
tabIndex={0}
aria-label={t(name)}
aria-pressed={!!editorState[`highlight_${color}`]}
onClick={applyHighlight}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
applyHighlight();
}
}} }}
style={{ style={{
width: rem(28), width: rem(28),
@@ -274,7 +302,8 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
)} )}
</Box> </Box>
</Tooltip> </Tooltip>
))} );
})}
</SimpleGrid> </SimpleGrid>
</Box> </Box>
@@ -157,6 +157,9 @@ export const NodeSelector: FC<NodeSelectorProps> = ({
radius="0" radius="0"
rightSection={<IconChevronDown size={16} />} rightSection={<IconChevronDown size={16} />}
onClick={() => setIsOpen(!isOpen)} onClick={() => setIsOpen(!isOpen)}
aria-label={t("Turn into")}
aria-haspopup="menu"
aria-expanded={isOpen}
> >
{t(activeItem?.name)} {t(activeItem?.name)}
</Button> </Button>
@@ -92,6 +92,9 @@ export const TextAlignmentSelector: FC<TextAlignmentProps> = ({
radius="0" radius="0"
rightSection={<IconChevronDown size={16} />} rightSection={<IconChevronDown size={16} />}
onClick={() => setIsOpen(!isOpen)} onClick={() => setIsOpen(!isOpen)}
aria-label={t("Text align")}
aria-haspopup="menu"
aria-expanded={isOpen}
> >
<activeItem.icon style={{ width: rem(16) }} stroke={2} /> <activeItem.icon style={{ width: rem(16) }} stroke={2} />
</Button> </Button>
@@ -137,7 +137,13 @@ export default function DrawioView(props: NodeViewProps) {
return ( return (
<NodeViewWrapper data-drag-handle> <NodeViewWrapper data-drag-handle>
<Modal.Root opened={opened} onClose={handleClose} fullScreen closeOnEscape={false}> <Modal.Root
opened={opened}
onClose={handleClose}
fullScreen
closeOnEscape={false}
aria-label={t("Diagram editor")}
>
<Modal.Overlay /> <Modal.Overlay />
<Modal.Content style={{ overflow: "hidden" }}> <Modal.Content style={{ overflow: "hidden" }}>
<Modal.Body pos="relative"> <Modal.Body pos="relative">
@@ -107,7 +107,17 @@ const EmojiList = ({
}, [selectedIndex]); }, [selectedIndex]);
return items.length > 0 || isLoading ? ( return items.length > 0 || isLoading ? (
<Paper id="emoji-command" p="0" shadow="md" withBorder> <Paper
id="emoji-command"
p="0"
shadow="md"
withBorder
role="listbox"
aria-label="Emoji results"
aria-activedescendant={
items.length > 0 ? `emoji-command-option-${selectedIndex}` : undefined
}
>
{isLoading && <Loader m="xs" color="blue" type="dots" />} {isLoading && <Loader m="xs" color="blue" type="dots" />}
{items.length > 0 && ( {items.length > 0 && (
<ScrollArea.Autosize <ScrollArea.Autosize
@@ -120,6 +130,10 @@ const EmojiList = ({
{items.map((item, index: number) => ( {items.map((item, index: number) => (
<ActionIcon <ActionIcon
data-item-index={index} data-item-index={index}
id={`emoji-command-option-${index}`}
role="option"
aria-selected={index === selectedIndex}
aria-label={item.id}
variant="transparent" variant="transparent"
key={item.id} key={item.id}
className={clsx(classes.menuBtn, { className={clsx(classes.menuBtn, {
@@ -102,6 +102,14 @@ export const LinkEditorPanel = ({
leftSection={<IconLink size={16} stroke={1.5} color="var(--mantine-color-dimmed)" />} leftSection={<IconLink size={16} stroke={1.5} color="var(--mantine-color-dimmed)" />}
classNames={{ input: classes.linkInput }} classNames={{ input: classes.linkInput }}
placeholder={t("Paste link or search pages")} placeholder={t("Paste link or search pages")}
aria-label={t("Paste link or search pages")}
role="combobox"
aria-expanded={showDropdown}
aria-controls="link-editor-results"
aria-autocomplete="list"
aria-activedescendant={
showDropdown ? `link-editor-option-${selectedIndex}` : undefined
}
value={state.url} value={state.url}
onChange={state.onChange} onChange={state.onChange}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
@@ -125,10 +133,16 @@ export const LinkEditorPanel = ({
scrollbarSize={6} scrollbarSize={6}
mt={state.url.length > 0 ? 8 : 0} mt={state.url.length > 0 ? 8 : 0}
styles={{ content: { minWidth: 0 } }} styles={{ content: { minWidth: 0 } }}
id="link-editor-results"
role="listbox"
aria-label={t("Link suggestions")}
> >
{showUrlItem && ( {showUrlItem && (
<UnstyledButton <UnstyledButton
data-item-index={0} data-item-index={0}
id="link-editor-option-0"
role="option"
aria-selected={selectedIndex === 0}
onClick={() => onSetLink(state.url, false)} onClick={() => onSetLink(state.url, false)}
className={clsx(classes.searchItem, { className={clsx(classes.searchItem, {
[classes.selectedSearchItem]: selectedIndex === 0, [classes.selectedSearchItem]: selectedIndex === 0,
@@ -156,6 +170,9 @@ export const LinkEditorPanel = ({
return ( return (
<UnstyledButton <UnstyledButton
data-item-index={itemIndex} data-item-index={itemIndex}
id={`link-editor-option-${itemIndex}`}
role="option"
aria-selected={itemIndex === selectedIndex}
key={page.id || index} key={page.id || index}
onClick={() => selectPage(page)} onClick={() => selectPage(page)}
className={clsx(classes.searchItem, { className={clsx(classes.searchItem, {
@@ -287,7 +287,16 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
); );
return ( return (
<Paper id="mention" shadow="md" withBorder radius="md" py={6}> <Paper
id="mention"
shadow="md"
withBorder
radius="md"
py={6}
role="listbox"
aria-label={t("Mention suggestions")}
aria-activedescendant={`mention-option-${selectedIndex}`}
>
<ScrollArea.Autosize <ScrollArea.Autosize
viewportRef={viewportRef} viewportRef={viewportRef}
mah={350} mah={350}
@@ -301,7 +310,7 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
if (item.entityType === "header") { if (item.entityType === "header") {
const isFirst = index === 0; const isFirst = index === 0;
return ( return (
<div key={`${item.label}-${index}`}> <div key={`${item.label}-${index}`} role="presentation">
{!isFirst && <Divider my={6} />} {!isFirst && <Divider my={6} />}
<Text <Text
c="dimmed" c="dimmed"
@@ -322,6 +331,9 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
<UnstyledButton <UnstyledButton
data-item-index={index} data-item-index={index}
key={index} key={index}
id={`mention-option-${index}`}
role="option"
aria-selected={index === selectedIndex}
onClick={() => selectItem(index)} onClick={() => selectItem(index)}
className={clsx(classes.menuBtn, { className={clsx(classes.menuBtn, {
[classes.selectedItem]: index === selectedIndex, [classes.selectedItem]: index === selectedIndex,
@@ -348,6 +360,9 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
<UnstyledButton <UnstyledButton
data-item-index={index} data-item-index={index}
key={index} key={index}
id={`mention-option-${index}`}
role="option"
aria-selected={index === selectedIndex}
onClick={() => selectItem(index)} onClick={() => selectItem(index)}
className={clsx(classes.menuBtn, { className={clsx(classes.menuBtn, {
[classes.selectedItem]: index === selectedIndex, [classes.selectedItem]: index === selectedIndex,
@@ -358,7 +373,7 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
<ActionIcon <ActionIcon
variant="subtle" variant="subtle"
component="div" component="div"
aria-label={item.label} aria-hidden="true"
color="gray" color="gray"
size="sm" size="sm"
> >
@@ -390,6 +405,11 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
{(hasUsers || hasPages) && <Divider my={6} />} {(hasUsers || hasPages) && <Divider my={6} />}
<UnstyledButton <UnstyledButton
data-item-index={renderItems.indexOf(createPageItemData)} data-item-index={renderItems.indexOf(createPageItemData)}
id={`mention-option-${renderItems.indexOf(createPageItemData)}`}
role="option"
aria-selected={
renderItems.indexOf(createPageItemData) === selectedIndex
}
onClick={() => onClick={() =>
selectItem(renderItems.indexOf(createPageItemData)) selectItem(renderItems.indexOf(createPageItemData))
} }
@@ -405,6 +425,7 @@ const MentionList = forwardRef<any, MentionListProps>((props, ref) => {
component="div" component="div"
color="gray" color="gray"
size="sm" size="sm"
aria-hidden="true"
> >
<IconPlus size={16} stroke={1.5} /> <IconPlus size={16} stroke={1.5} />
</ActionIcon> </ActionIcon>
@@ -92,7 +92,20 @@ export default function PdfView(props: NodeViewProps) {
if (hasError) { if (hasError) {
return ( return (
<NodeViewWrapper data-drag-handle> <NodeViewWrapper data-drag-handle>
<div data-pdf-error className={clsx(classes.pdfError, { "ProseMirror-selectednode": selected })} onClick={handleSelect}> <div
data-pdf-error
className={clsx(classes.pdfError, { "ProseMirror-selectednode": selected })}
onClick={handleSelect}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleSelect();
}
}}
role="button"
tabIndex={0}
aria-label={t("Failed to load PDF")}
>
<IconFileTypePdf size={32} stroke={1.5} /> <IconFileTypePdf size={32} stroke={1.5} />
<Text size="sm" c="dimmed"> <Text size="sm" c="dimmed">
{t("Failed to load PDF")} {t("Failed to load PDF")}
@@ -187,6 +187,7 @@ function SearchAndReplaceDialog({ editor, editable = true }: PageFindDialogDialo
position={{ top: 90, right: 50 }} position={{ top: 90, right: 50 }}
withBorder withBorder
transitionProps={{ transition: "slide-down" }} transitionProps={{ transition: "slide-down" }}
aria-label={t("Find and replace")}
> >
<Stack gap="xs"> <Stack gap="xs">
<Flex align="center" gap="xs"> <Flex align="center" gap="xs">
@@ -86,7 +86,15 @@ const CommandList = ({
}, [selectedIndex]); }, [selectedIndex]);
return flatItems.length > 0 ? ( return flatItems.length > 0 ? (
<Paper id="slash-command" shadow="md" p="xs" withBorder> <Paper
id="slash-command"
shadow="md"
p="xs"
withBorder
role="listbox"
aria-label={t("Slash commands")}
aria-activedescendant={`slash-command-option-${selectedIndex}`}
>
<ScrollArea <ScrollArea
viewportRef={viewportRef} viewportRef={viewportRef}
h={350} h={350}
@@ -95,7 +103,7 @@ const CommandList = ({
overscrollBehavior="contain" overscrollBehavior="contain"
> >
{Object.entries(items).map(([category, categoryItems]) => ( {Object.entries(items).map(([category, categoryItems]) => (
<div key={category}> <div key={category} role="group" aria-label={category}>
<Text c="dimmed" mb={4} fw={500} tt="capitalize"> <Text c="dimmed" mb={4} fw={500} tt="capitalize">
{category} {category}
</Text> </Text>
@@ -103,13 +111,16 @@ const CommandList = ({
<UnstyledButton <UnstyledButton
data-item-index={index} data-item-index={index}
key={index} key={index}
id={`slash-command-option-${index}`}
role="option"
aria-selected={index === selectedIndex}
onClick={() => selectItem(index)} onClick={() => selectItem(index)}
className={clsx(classes.menuBtn, { className={clsx(classes.menuBtn, {
[classes.selectedItem]: index === selectedIndex, [classes.selectedItem]: index === selectedIndex,
})} })}
> >
<Group> <Group>
<ActionIcon variant="default" component="div"> <ActionIcon variant="default" component="div" aria-hidden="true">
<item.icon size={18} /> <item.icon size={18} />
</ActionIcon> </ActionIcon>
@@ -92,8 +92,17 @@ export default function StatusView(props: NodeViewProps) {
colorClassMap[color], colorClassMap[color],
)} )}
onClick={() => isEditable && setOpened(true)} onClick={() => isEditable && setOpened(true)}
onKeyDown={(e) => {
if (isEditable && (e.key === "Enter" || e.key === " ")) {
e.preventDefault();
setOpened(true);
}
}}
role="button" role="button"
tabIndex={0} tabIndex={0}
aria-label={text || "SET STATUS"}
aria-haspopup="dialog"
aria-expanded={opened}
> >
{text || "SET STATUS"} {text || "SET STATUS"}
</span> </span>
@@ -127,6 +136,16 @@ export default function StatusView(props: NodeViewProps) {
)} )}
style={{ backgroundColor: bg }} style={{ backgroundColor: bg }}
onClick={() => handleColorChange(name)} onClick={() => handleColorChange(name)}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
handleColorChange(name);
}
}}
role="button"
tabIndex={0}
aria-label={name}
aria-pressed={color === name}
> >
{color === name && <IconCheck size={14} />} {color === name && <IconCheck size={14} />}
</Box> </Box>
@@ -53,7 +53,7 @@ export default function GroupActionMenu() {
arrowPosition="center" arrowPosition="center"
> >
<Menu.Target> <Menu.Target>
<ActionIcon variant="light"> <ActionIcon variant="light" aria-label={t("Group menu")}>
<IconDots size={20} stroke={2} /> <IconDots size={20} stroke={2} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>
@@ -22,6 +22,7 @@ export default function HistoryModal({ pageId, pageTitle }: Props) {
opened={isModalOpen} opened={isModalOpen}
onClose={() => setModalOpen(false)} onClose={() => setModalOpen(false)}
fullScreen fullScreen
aria-label={t("Page history")}
> >
<Modal.Overlay /> <Modal.Overlay />
<Modal.Content style={{ overflow: "hidden" }}> <Modal.Content style={{ overflow: "hidden" }}>
@@ -49,6 +50,7 @@ export default function HistoryModal({ pageId, pageTitle }: Props) {
size={1400} size={1400}
opened={isModalOpen} opened={isModalOpen}
onClose={() => setModalOpen(false)} onClose={() => setModalOpen(false)}
aria-label={t("Page history")}
> >
<Modal.Overlay /> <Modal.Overlay />
<Modal.Content style={{ overflow: "hidden" }}> <Modal.Content style={{ overflow: "hidden" }}>
@@ -19,6 +19,7 @@ import { buildPageUrl } from "@/features/page/page.utils.ts";
import { usePageQuery } from "@/features/page/queries/page-query.ts"; import { usePageQuery } from "@/features/page/queries/page-query.ts";
import { extractPageSlugId } from "@/lib"; import { extractPageSlugId } from "@/lib";
import { useMediaQuery } from "@mantine/hooks"; import { useMediaQuery } from "@mantine/hooks";
import { useTranslation } from "react-i18next";
function getTitle(name: string, icon: string) { function getTitle(name: string, icon: string) {
if (icon) { if (icon) {
@@ -28,6 +29,7 @@ function getTitle(name: string, icon: string) {
} }
export default function Breadcrumb() { export default function Breadcrumb() {
const { t } = useTranslation();
const treeData = useAtomValue(treeDataAtom); const treeData = useAtomValue(treeDataAtom);
const [breadcrumbNodes, setBreadcrumbNodes] = useState< const [breadcrumbNodes, setBreadcrumbNodes] = useState<
SpaceTreeNode[] | null SpaceTreeNode[] | null
@@ -115,7 +117,11 @@ export default function Breadcrumb() {
key="hidden-nodes" key="hidden-nodes"
> >
<Popover.Target> <Popover.Target>
<ActionIcon color="gray" variant="transparent"> <ActionIcon
color="gray"
variant="transparent"
aria-label={t("Show hidden breadcrumbs")}
>
<IconDots size={20} stroke={2} /> <IconDots size={20} stroke={2} />
</ActionIcon> </ActionIcon>
</Popover.Target> </Popover.Target>
@@ -144,8 +150,12 @@ export default function Breadcrumb() {
key="mobile-hidden-nodes" key="mobile-hidden-nodes"
> >
<Popover.Target> <Popover.Target>
<Tooltip label="Breadcrumbs"> <Tooltip label={t("Breadcrumbs")}>
<ActionIcon color="gray" variant="transparent"> <ActionIcon
color="gray"
variant="transparent"
aria-label={t("Breadcrumbs")}
>
<IconCornerDownRightDouble size={20} stroke={2} /> <IconCornerDownRightDouble size={20} stroke={2} />
</ActionIcon> </ActionIcon>
</Tooltip> </Tooltip>
@@ -205,7 +205,11 @@ function PageActionMenu({ readOnly }: PageActionMenuProps) {
arrowPosition="center" arrowPosition="center"
> >
<Menu.Target> <Menu.Target>
<ActionIcon variant="subtle" color="dark"> <ActionIcon
variant="subtle"
color="dark"
aria-label={t("Page actions")}
>
<IconDots size={20} /> <IconDots size={20} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>
@@ -19,7 +19,7 @@ export default function TrashPageContentModal({
const title = pageTitle || t("Untitled"); const title = pageTitle || t("Untitled");
return ( return (
<Modal.Root size={1200} opened={opened} onClose={onClose}> <Modal.Root size={1200} opened={opened} onClose={onClose} aria-label={t("Preview")}>
<Modal.Overlay /> <Modal.Overlay />
<Modal.Content style={{ overflow: "hidden" }}> <Modal.Content style={{ overflow: "hidden" }}>
<Modal.Header> <Modal.Header>
@@ -458,6 +458,8 @@ interface CreateNodeProps {
} }
function CreateNode({ node, treeApi, onExpandTree }: CreateNodeProps) { function CreateNode({ node, treeApi, onExpandTree }: CreateNodeProps) {
const { t } = useTranslation();
function handleCreate() { function handleCreate() {
if (node.data.hasChildren && node.children.length === 0) { if (node.data.hasChildren && node.children.length === 0) {
node.toggle(); node.toggle();
@@ -475,6 +477,7 @@ function CreateNode({ node, treeApi, onExpandTree }: CreateNodeProps) {
<ActionIcon <ActionIcon
variant="transparent" variant="transparent"
c="gray" c="gray"
aria-label={t("Create page")}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -591,6 +594,7 @@ function NodeMenu({ node, treeApi, spaceId }: NodeMenuProps) {
<ActionIcon <ActionIcon
variant="transparent" variant="transparent"
c="gray" c="gray"
aria-label={t("Page menu")}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -725,6 +729,8 @@ interface PageArrowProps {
} }
function PageArrow({ node, onExpandTree }: PageArrowProps) { function PageArrow({ node, onExpandTree }: PageArrowProps) {
const { t } = useTranslation();
useEffect(() => { useEffect(() => {
if (node.isOpen) { if (node.isOpen) {
onExpandTree(); onExpandTree();
@@ -736,6 +742,8 @@ function PageArrow({ node, onExpandTree }: PageArrowProps) {
size={20} size={20}
variant="subtle" variant="subtle"
c="gray" c="gray"
aria-label={node.isOpen ? t("Collapse") : t("Expand")}
aria-expanded={node.isInternal ? node.isOpen : undefined}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@@ -75,7 +75,7 @@ export default function ShareActionMenu({ share }: Props) {
arrowPosition="center" arrowPosition="center"
> >
<Menu.Target> <Menu.Target>
<ActionIcon variant="subtle" c="gray"> <ActionIcon variant="subtle" c="gray" aria-label={t("More options")}>
<IconDots size={20} stroke={2} /> <IconDots size={20} stroke={2} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>
@@ -148,6 +148,7 @@ export default function ShareShell({
onClick={toggleTocMobile} onClick={toggleTocMobile}
hiddenFrom="sm" hiddenFrom="sm"
size="sm" size="sm"
aria-label={t("Table of contents")}
> >
<IconList size={20} stroke={2} /> <IconList size={20} stroke={2} />
</ActionIcon> </ActionIcon>
@@ -157,6 +158,7 @@ export default function ShareShell({
<ActionIcon <ActionIcon
variant="default" variant="default"
style={{ border: "none" }} style={{ border: "none" }}
aria-label={t("Table of contents")}
onClick={toggleToc} onClick={toggleToc}
visibleFrom="sm" visibleFrom="sm"
size="sm" size="sm"
@@ -168,7 +168,11 @@ export default function AllSpacesList({
<WatchButton spaceId={space.id} watchedIds={watchedIds} size={16} /> <WatchButton spaceId={space.id} watchedIds={watchedIds} size={16} />
<Menu position="bottom-end"> <Menu position="bottom-end">
<Menu.Target> <Menu.Target>
<ActionIcon variant="subtle" color="gray"> <ActionIcon
variant="subtle"
color="gray"
aria-label={t("Space menu")}
>
<IconDots size={16} /> <IconDots size={16} />
</ActionIcon> </ActionIcon>
</Menu.Target> </Menu.Target>