From d43ed215dc079a4a63a4b3ff5e1532d0bdc7b215 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Wed, 10 Aug 2022 12:06:46 +0200 Subject: [PATCH] SONAR-16782 [893332] The decorative image is not hidden from screen readers --- .../main/js/apps/issues/sidebar/ScopeFacet.tsx | 6 +++++- .../__snapshots__/ScopeFacet-test.tsx.snap | 6 ++++++ .../main/js/components/icons/QualifierIcon.tsx | 18 +++++++++++------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx index e21c5798bd5..f831854f467 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx @@ -67,7 +67,11 @@ export default function ScopeFacet(props: ScopeFacetProps) { key={scope} name={ - {' '} + {' '} {translate('issue.scope', scope)} } diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ScopeFacet-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ScopeFacet-test.tsx.snap index c92cd880a4e..034d490ba1a 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ScopeFacet-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ScopeFacet-test.tsx.snap @@ -27,6 +27,7 @@ exports[`should render correctly: active facet 1`] = ` className="display-flex-center" > @@ -47,6 +48,7 @@ exports[`should render correctly: active facet 1`] = ` className="display-flex-center" > @@ -103,6 +105,7 @@ exports[`should render correctly: disabled facet 1`] = ` className="display-flex-center" > @@ -124,6 +127,7 @@ exports[`should render correctly: disabled facet 1`] = ` className="display-flex-center" > @@ -165,6 +169,7 @@ exports[`should render correctly: open 1`] = ` className="display-flex-center" > @@ -185,6 +190,7 @@ exports[`should render correctly: open 1`] = ` className="display-flex-center" > diff --git a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx index 57cef682ed5..2c97d64e948 100644 --- a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx +++ b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx @@ -34,22 +34,26 @@ const qualifierIcons: Dict<(props: IconProps) => React.ReactElement> = { vw: PortfolioIcon }; -interface QualifierIconProps { +interface QualifierIconProps extends IconProps { className?: string; fill?: string; qualifier: string | null | undefined; } -export default function QualifierIcon(props: QualifierIconProps) { - if (!props.qualifier) { +export default function QualifierIcon({ + qualifier, + className, + fill, + ...props +}: QualifierIconProps) { + if (!qualifier) { return null; } - const qualifier = props.qualifier.toLowerCase(); - const FoundIcon = qualifierIcons[qualifier]; - const ariaLabel = props.qualifier != null ? translate(`qualifier.${props.qualifier}`) : undefined; + const FoundIcon = qualifierIcons[qualifier.toLowerCase()]; + const ariaLabel = qualifier != null ? translate(`qualifier.${qualifier}`) : undefined; return FoundIcon ? ( - + ) : null; } -- 2.39.5