aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>2024-07-25 17:39:12 +0200
committersonartech <sonartech@sonarsource.com>2024-07-30 20:02:34 +0000
commite9c31fd48edf9ae0f23bae563a975b5e9b71d0d9 (patch)
tree97676d083317ba154bd40a3bf21c1dfae695d3b9 /server
parent92ebb5c2a92b64d49c826c8c485cae0c4ee8ade5 (diff)
downloadsonarqube-e9c31fd48edf9ae0f23bae563a975b5e9b71d0d9.tar.gz
sonarqube-e9c31fd48edf9ae0f23bae563a975b5e9b71d0d9.zip
SONAR-22303 Fix aria-label misuse (Deque issue #1744830)
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
index ec8d80d70fe..e33c391ec37 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/MeasuresCardPercent.tsx
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react';
import classNames from 'classnames';
import { CoverageIndicator, DuplicationsIndicator, LightLabel, TextError } from 'design-system';
@@ -28,6 +29,7 @@ import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
import { duplicationRatingConverter, getLeakValue } from '../../../components/measure/utils';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { findMeasure, localizeMetric } from '../../../helpers/measures';
+import { isDefined } from '../../../helpers/types';
import { getComponentDrilldownUrl } from '../../../helpers/urls';
import { isPullRequest } from '../../../sonar-aligned/helpers/branch-like';
import { BranchLike } from '../../../types/branch-like';
@@ -58,7 +60,7 @@ interface Props {
}
export default function MeasuresCardPercent(
- props: React.PropsWithChildren<Props & React.HTMLAttributes<HTMLDivElement>>,
+ props: Readonly<React.PropsWithChildren<Props & React.HTMLAttributes<HTMLDivElement>>>,
) {
const {
componentKey,
@@ -97,6 +99,8 @@ export default function MeasuresCardPercent(
const shouldRenderRequiredLabel = showRequired && condition;
+ const formattedMeasure = formatMeasure(linesValue ?? '0', MetricType.ShortInteger);
+
return (
<MeasuresCard
value={formatMeasure(value, MetricType.Percent)}
@@ -134,13 +138,13 @@ export default function MeasuresCardPercent(
highlight={LinkHighlight.Default}
aria-label={translateWithParameters(
'overview.see_more_details_on_x_y',
- linesValue ?? '0',
+ isDefined(linesValue) ? `${formattedMeasure} (${linesValue})` : '0',
localizeMetric(linesMetric),
)}
className="sw-body-sm-highlight sw--mt-[3px]"
to={linesUrl}
>
- {formatMeasure(linesValue ?? '0', MetricType.ShortInteger)}
+ {formattedMeasure}
</LinkStandalone>
),
}}