From: Mathieu Suen Date: Thu, 25 Aug 2022 09:22:40 +0000 (+0200) Subject: SONAR-16820 Text alternative is missing X-Git-Tag: 9.7.0.61563~321 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=98ee2c9b75b3eb06660cce5556b5eb130a31546d;p=sonarqube.git SONAR-16820 Text alternative is missing --- diff --git a/server/sonar-web/src/main/js/components/controls/BackButton.tsx b/server/sonar-web/src/main/js/components/controls/BackButton.tsx index 68cc3368223..5ffe0fa483f 100644 --- a/server/sonar-web/src/main/js/components/controls/BackButton.tsx +++ b/server/sonar-web/src/main/js/components/controls/BackButton.tsx @@ -39,14 +39,17 @@ export default class BackButton extends React.PureComponent { } }; - renderIcon = () => ( - - - - ); + renderIcon = () => { + const { tooltip = translate('issues.return_to_list') } = this.props; + return ( + + + + ); + }; render() { const { tooltip = translate('issues.return_to_list') } = this.props; diff --git a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx index 2b7b07f17b4..57452118cb6 100644 --- a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx +++ b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx @@ -382,6 +382,7 @@ export class TooltipInner extends React.Component { }; render() { + const isVisible = this.isVisible(); return ( <> {React.cloneElement(this.props.children, { @@ -394,10 +395,10 @@ export class TooltipInner extends React.Component { // always well supported. As a fallback, we use aria-labelledby as well. // See https://sarahmhigley.com/writing/tooltips-in-wcag-21/ // See https://css-tricks.com/accessible-svgs/ - 'aria-describedby': this.id, - 'aria-labelledby': this.id + 'aria-describedby': isVisible ? this.id : undefined, + 'aria-labelledby': isVisible ? this.id : undefined })} - {this.isVisible() && ( + {isVisible && ( diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap index a4fc44f5eca..5d932f59cc1 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/BackButton-test.tsx.snap @@ -10,6 +10,7 @@ exports[`should handle click 1`] = ` onClick={[Function]} >