From 6fdab5fe700dcddbcb8fe3fee93a4b34cf24126b Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Mon, 20 Apr 2026 19:45:55 +0100 Subject: [PATCH] accessibility --- .../public/locales/en-US/translation.json | 8 ++- .../layouts/global/app-shell.module.css | 18 ++++++ .../layouts/global/global-app-shell.tsx | 37 +++++++++-- .../layouts/global/global-sidebar.tsx | 12 ++-- .../components/settings/settings-sidebar.tsx | 61 ++++++++++--------- .../editor/components/audio/audio-view.tsx | 4 +- .../search-and-replace-dialog.tsx | 27 +++++++- .../components/slash-menu/command-list.tsx | 27 +++++--- .../editor/components/video/video-view.tsx | 4 +- .../components/breadcrumbs/breadcrumb.tsx | 17 ++++-- 10 files changed, 152 insertions(+), 63 deletions(-) diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index 5e2e5135..60b1eeeb 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -899,5 +899,11 @@ "Link suggestions": "Link suggestions", "Diagram editor": "Diagram editor", "Add comment": "Add comment", - "Find and replace": "Find and replace" + "Find and replace": "Find and replace", + "Main navigation": "Main navigation", + "Space navigation": "Space navigation", + "Settings navigation": "Settings navigation", + "AI navigation": "AI navigation", + "Breadcrumb": "Breadcrumb", + "Skip to main content": "Skip to main content" } diff --git a/apps/client/src/components/layouts/global/app-shell.module.css b/apps/client/src/components/layouts/global/app-shell.module.css index ed369612..7ed93772 100644 --- a/apps/client/src/components/layouts/global/app-shell.module.css +++ b/apps/client/src/components/layouts/global/app-shell.module.css @@ -28,4 +28,22 @@ } } +.skipLink { + position: fixed; + left: 8px; + top: 8px; + padding: 8px 12px; + background: var(--mantine-color-blue-6); + color: #fff; + border-radius: 4px; + text-decoration: none; + z-index: 1000; + transform: translateY(-150%); + + &:focus { + transform: translateY(0); + outline: 2px solid var(--mantine-color-blue-3); + } +} + diff --git a/apps/client/src/components/layouts/global/global-app-shell.tsx b/apps/client/src/components/layouts/global/global-app-shell.tsx index 64bd3dde..7b0c7cbe 100644 --- a/apps/client/src/components/layouts/global/global-app-shell.tsx +++ b/apps/client/src/components/layouts/global/global-app-shell.tsx @@ -1,6 +1,7 @@ import { AppShell, Container } from "@mantine/core"; import React, { useEffect, useRef, useState } from "react"; import { useLocation } from "react-router-dom"; +import { useTranslation } from "react-i18next"; import SettingsSidebar from "@/components/settings/settings-sidebar.tsx"; import { useAtom } from "jotai"; import { @@ -23,11 +24,12 @@ export default function GlobalAppShell({ }: { children: React.ReactNode; }) { + const { t } = useTranslation(); useTrialEndAction(); const [mobileOpened] = useAtom(mobileSidebarAtom); const toggleMobile = useToggleSidebar(mobileSidebarAtom); const [desktopOpened] = useAtom(desktopSidebarAtom); - const [{ isAsideOpen }] = useAtom(asideStateAtom); + const [{ isAsideOpen, tab: asideTab }] = useAtom(asideStateAtom); const [sidebarWidth, setSidebarWidth] = useAtom(sidebarWidthAtom); const [isResizing, setIsResizing] = useState(false); const sidebarRef = useRef(null); @@ -79,7 +81,11 @@ export default function GlobalAppShell({ const showGlobalSidebar = !isSpaceRoute && !isSettingsRoute && !isAiRoute; return ( - + + {t("Skip to main content")} + + {isSpaceRoute && (
@@ -114,7 +129,7 @@ export default function GlobalAppShell({ {isAiRoute && } {showGlobalSidebar && } - + {isSettingsRoute ? ( {children} ) : ( @@ -123,10 +138,24 @@ export default function GlobalAppShell({ {isPageRoute && ( - +
diff --git a/apps/client/src/features/editor/components/search-and-replace/search-and-replace-dialog.tsx b/apps/client/src/features/editor/components/search-and-replace/search-and-replace-dialog.tsx index 698666e0..a6054d22 100644 --- a/apps/client/src/features/editor/components/search-and-replace/search-and-replace-dialog.tsx +++ b/apps/client/src/features/editor/components/search-and-replace/search-and-replace-dialog.tsx @@ -194,6 +194,7 @@ function SearchAndReplaceDialog({ editor, editable = true }: PageFindDialogDialo } rightSection={ @@ -218,7 +219,12 @@ function SearchAndReplaceDialog({ editor, editable = true }: PageFindDialogDialo - + - + caseSensitiveToggle()} + aria-label={t("Match case (Alt+C)")} + aria-pressed={caseSensitive.isCaseSensitive} > replaceButtonToggle()} + aria-label={t("Replace")} + aria-pressed={replaceButton.isReplaceShow} > )} - + @@ -270,6 +290,7 @@ function SearchAndReplaceDialog({ editor, editable = true }: PageFindDialogDialo } rightSection={
} rightSectionPointerEvents="all" diff --git a/apps/client/src/features/editor/components/slash-menu/command-list.tsx b/apps/client/src/features/editor/components/slash-menu/command-list.tsx index a6132bcb..ebc06660 100644 --- a/apps/client/src/features/editor/components/slash-menu/command-list.tsx +++ b/apps/client/src/features/editor/components/slash-menu/command-list.tsx @@ -102,21 +102,26 @@ const CommandList = ({ scrollbarSize={8} overscrollBehavior="contain" > - {Object.entries(items).map(([category, categoryItems]) => ( + {(() => { + let flatIndex = -1; + return Object.entries(items).map(([category, categoryItems]) => (
{category} - {categoryItems.map((item: SlashMenuItemType, index: number) => ( + {categoryItems.map((item: SlashMenuItemType) => { + flatIndex += 1; + const itemIndex = flatIndex; + return ( selectItem(index)} + aria-selected={itemIndex === selectedIndex} + onClick={() => selectItem(itemIndex)} className={clsx(classes.menuBtn, { - [classes.selectedItem]: index === selectedIndex, + [classes.selectedItem]: itemIndex === selectedIndex, })} > @@ -135,9 +140,11 @@ const CommandList = ({
- ))} + ); + })} - ))} + )); + })()} ) : null; diff --git a/apps/client/src/features/editor/components/video/video-view.tsx b/apps/client/src/features/editor/components/video/video-view.tsx index 46ff7908..9a67533b 100644 --- a/apps/client/src/features/editor/components/video/video-view.tsx +++ b/apps/client/src/features/editor/components/video/video-view.tsx @@ -47,6 +47,7 @@ export default function VideoView(props: NodeViewProps) { preload="metadata" controls src={getFileUrl(src)} + aria-label={placeholder?.name || t("Video")} /> )} {!src && previewSrc && ( @@ -56,6 +57,7 @@ export default function VideoView(props: NodeViewProps) { preload="metadata" controls src={previewSrc} + aria-label={placeholder?.name || t("Video")} /> @@ -71,7 +73,7 @@ export default function VideoView(props: NodeViewProps) { )} {!src && !previewSrc && !placeholder && ( -