From a47c3d4fc46850a3f8db272505eef65e26a10ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till-Andr=C3=A9=20Diegeler?= Date: Mon, 24 Mar 2025 14:54:32 +0100 Subject: [PATCH] Add focus-zone css class & Breadcrumb accessibility improvements --- scm-ui/ui-components/src/Breadcrumb.tsx | 41 ++-- .../src/__snapshots__/storyshots.test.ts.snap | 182 +++++++++++------- scm-ui/ui-styles/src/components/_main.scss | 17 ++ .../ui-webapp/public/locales/de/commons.json | 1 + .../ui-webapp/public/locales/en/commons.json | 1 + 5 files changed, 157 insertions(+), 85 deletions(-) diff --git a/scm-ui/ui-components/src/Breadcrumb.tsx b/scm-ui/ui-components/src/Breadcrumb.tsx index 6aed0e5ad9..7935f12db8 100644 --- a/scm-ui/ui-components/src/Breadcrumb.tsx +++ b/scm-ui/ui-components/src/Breadcrumb.tsx @@ -22,10 +22,9 @@ import styled from "styled-components"; import { urls } from "@scm-manager/ui-api"; import { Branch, File, Repository } from "@scm-manager/ui-types"; import { binder, ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions"; -import Icon from "./Icon"; -import Tooltip from "./Tooltip"; import copyToClipboard from "./CopyToClipboard"; import { devices } from "./devices"; +import { Icon, Tooltip } from "@scm-manager/ui-core"; type Props = { repository: Repository; @@ -110,7 +109,7 @@ const BreadcrumbNode: FC<{ clickable: boolean; text: string; url: string; curren clickable, text, url, - current + current, }) => { if (clickable) { return ( @@ -137,7 +136,7 @@ const Breadcrumb: FC = ({ sources, permalink, preButtons, - clickable = true + clickable = true, }) => { const location = useLocation(); const history = useHistory(); @@ -212,24 +211,44 @@ const Breadcrumb: FC = ({ aria-label="breadcrumbs" > {prefixButtons} -
    +
    • {clickable ? ( - + home ) : ( - + home )}
    • {pathSection()}
    - e.key === "Enter" && copySource()}> + {copying ? ( - + + spinner fa-spin + ) : ( - copySource()} alt={t("breadcrumb.copyPermalink")} /> + copySource()} + onKeyDown={(e) => e.key === "Enter" && copySource()} + > + link + )} @@ -243,7 +262,7 @@ const Breadcrumb: FC = ({ branch: branch ? branch : defaultBranch, path, sources, - repository + repository, }; const renderExtensionPoints = () => { diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index bf92272525..5375b3982c 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -70,19 +70,23 @@ exports[`Storyshots BreadCrumb Default 1`] = ` aria-label="breadcrumbs" className="Breadcrumb__BreadcrumbNav-sc-zvtb4t-1 dInwRH breadcrumb sources-breadcrumb mx-2 my-4 is-flex is-align-items-center is-full-width" > -
      +
      • - +
      • @@ -140,23 +144,27 @@ exports[`Storyshots BreadCrumb Default 1`] = `
      -
      -
      +
      -
        +
        • - +
        • @@ -300,23 +312,27 @@ exports[`Storyshots BreadCrumb Long path 1`] = `
        -
        -
        +
        -
          +
          • - +
          -
          -
          +
          -
            +
            • - +
            • @@ -514,23 +544,27 @@ exports[`Storyshots BreadCrumb With prefix button 1`] = `
            -
            -
            +