aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx2
4 files changed, 8 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
index 4f1e2a4afa7..cc0388f5704 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
@@ -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();
diff --git a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
index c513b825422..783c6c984e8 100644
--- a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
@@ -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) {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
index 405408aa518..f2ecb48cce8 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
@@ -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>
))}
diff --git a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx
index 01f47307ca1..535a24b2d11 100644
--- a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx
+++ b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx
@@ -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>
);