]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18362 Text Alternative is missing
authorstanislavh <stanislav.honcharov@sonarsource.com>
Fri, 10 Feb 2023 09:54:39 +0000 (10:54 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 10 Feb 2023 20:02:45 +0000 (20:02 +0000)
server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx

index 4f1e2a4afa7b84b818217ebd075bf8fd977c18e6..cc0388f57047cbbfaed20dc76bbeaf9989d2abda 100644 (file)
@@ -52,7 +52,7 @@ jest.mock('../helpers/lines', () => {
 
 const ui = {
   codeSmellTypeButton: byRole('button', { name: 'issue.type.CODE_SMELL' }),
-  minorSeverityButton: byRole('button', { name: 'severity.MINOR' }),
+  minorSeverityButton: byRole('button', { name: /severity.MINOR/ }),
 };
 
 const componentsHandler = new ComponentsServiceMock();
index c513b82542288c7828f3713fae557a82382c13d1..783c6c984e8a3c16840e5c7a6f2cd87cee8331b1 100644 (file)
@@ -19,6 +19,7 @@
  */
 import * as React from 'react';
 import { colors } from '../../app/theme';
+import { translate } from '../../helpers/l10n';
 import { Dict } from '../../types/types';
 import Icon, { IconProps } from './Icon';
 
@@ -34,13 +35,15 @@ const severityIcons: Dict<(props: IconProps) => React.ReactElement> = {
   info: InfoSeverityIcon,
 };
 
-export default function SeverityIcon({ severity, ...iconProps }: Props) {
+export default function SeverityIcon({ severity, ariaLabel, ...iconProps }: Props) {
   if (!severity) {
     return null;
   }
 
   const DesiredIcon = severityIcons[severity.toLowerCase()];
-  return DesiredIcon ? <DesiredIcon {...iconProps} /> : null;
+  return DesiredIcon ? (
+    <DesiredIcon {...iconProps} ariaLabel={ariaLabel ?? translate('severity', severity)} />
+  ) : null;
 }
 
 function BlockerSeverityIcon(iconProps: IconProps) {
index 405408aa5186267f942bf28654482f3c1a08e9f1..f2ecb48cce85a4a39a77f8b5bddbbbb3f4f1e8b4 100644 (file)
@@ -38,7 +38,7 @@ export default function SetSeverityPopup({ issue, onSelect }: Props) {
       <SelectList currentItem={issue.severity} items={SEVERITY} onSelect={onSelect}>
         {SEVERITY.map((severity) => (
           <SelectListItem className="display-flex-center" item={severity} key={severity}>
-            <SeverityIcon className="little-spacer-right" severity={severity} />
+            <SeverityIcon className="little-spacer-right" severity={severity} aria-hidden={true} />
             {translate('severity', severity)}
           </SelectListItem>
         ))}
index 01f47307ca1d8986bc0ec9578342a0cabf16b3bb..535a24b2d11160192df040dafa13ef464b5e0d76 100644 (file)
@@ -32,7 +32,7 @@ export default function SeverityHelper({ className, severity }: Props) {
   }
   return (
     <span className={className}>
-      <SeverityIcon className="little-spacer-right" severity={severity} />
+      <SeverityIcon className="little-spacer-right" severity={severity} aria-hidden={true} />
       {translate('severity', severity)}
     </span>
   );