diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-08-25 11:22:40 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-08-26 20:03:25 +0000 |
commit | 98ee2c9b75b3eb06660cce5556b5eb130a31546d (patch) | |
tree | ed52e632e754a21a556cbb9ef49843a3089cd759 /server | |
parent | 6a4d191b95cdf2eb92c281cfa51a99faa919a520 (diff) | |
download | sonarqube-98ee2c9b75b3eb06660cce5556b5eb130a31546d.tar.gz sonarqube-98ee2c9b75b3eb06660cce5556b5eb130a31546d.zip |
SONAR-16820 Text alternative is missing
Diffstat (limited to 'server')
4 files changed, 17 insertions, 13 deletions
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<Props> { } }; - renderIcon = () => ( - <svg height="24" viewBox="0 0 21 24" width="21"> - <path - d="M3.845 12.9992l5.993 5.993.052.056c.049.061.093.122.129.191.082.159.121.339.111.518-.006.102-.028.203-.064.298-.149.39-.537.652-.954.644-.102-.002-.204-.019-.301-.052-.148-.05-.273-.135-.387-.241l-8.407-8.407 8.407-8.407.056-.052c.061-.048.121-.092.19-.128.116-.06.237-.091.366-.108.076-.004.075-.004.153-.003.155.015.3.052.437.129.088.051.169.115.239.19.246.266.33.656.214.999-.051.149-.135.273-.241.387l-5.983 5.984c5.287-.044 10.577-.206 15.859.013.073.009.091.009.163.027.187.047.359.15.49.292.075.081.136.175.18.276.044.101.072.209.081.319.032.391-.175.775-.521.962-.097.052-.202.089-.311.107-.073.012-.091.01-.165.013H3.845z" - fill={this.props.disabled ? colors.disableGrayText : colors.secondFontColor} - /> - </svg> - ); + renderIcon = () => { + const { tooltip = translate('issues.return_to_list') } = this.props; + return ( + <svg height="24" viewBox="0 0 21 24" width="21" aria-label={tooltip}> + <path + d="M3.845 12.9992l5.993 5.993.052.056c.049.061.093.122.129.191.082.159.121.339.111.518-.006.102-.028.203-.064.298-.149.39-.537.652-.954.644-.102-.002-.204-.019-.301-.052-.148-.05-.273-.135-.387-.241l-8.407-8.407 8.407-8.407.056-.052c.061-.048.121-.092.19-.128.116-.06.237-.091.366-.108.076-.004.075-.004.153-.003.155.015.3.052.437.129.088.051.169.115.239.19.246.266.33.656.214.999-.051.149-.135.273-.241.387l-5.983 5.984c5.287-.044 10.577-.206 15.859.013.073.009.091.009.163.027.187.047.359.15.49.292.075.081.136.175.18.276.044.101.072.209.081.319.032.391-.175.775-.521.962-.097.052-.202.089-.311.107-.073.012-.091.01-.165.013H3.845z" + fill={this.props.disabled ? colors.disableGrayText : colors.secondFontColor} + /> + </svg> + ); + }; 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<TooltipProps, State> { }; render() { + const isVisible = this.isVisible(); return ( <> {React.cloneElement(this.props.children, { @@ -394,10 +395,10 @@ export class TooltipInner extends React.Component<TooltipProps, State> { // 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 && ( <EscKeydownHandler onKeydown={this.handleBlur}> <TooltipPortal> <ScreenPositionFixer ready={isMeasured(this.state)}> 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]} > <svg + aria-label="issues.return_to_list" height="24" viewBox="0 0 21 24" width="21" @@ -33,6 +34,7 @@ exports[`should render properly 1`] = ` onClick={[Function]} > <svg + aria-label="issues.return_to_list" height="24" viewBox="0 0 21 24" width="21" diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap index a1215a300a6..219cc2689cf 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/Tooltip-test.tsx.snap @@ -15,8 +15,6 @@ exports[`should not render empty tooltips 2`] = ` exports[`should render 1`] = ` <Fragment> <div - aria-describedby="tooltip-1" - aria-labelledby="tooltip-1" id="tooltip" onBlur={[Function]} onFocus={[Function]} |