diff options
author | David Cho-Lerat <david.cho-lerat@sonarsource.com> | 2024-07-30 16:49:55 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-07-30 20:02:34 +0000 |
commit | 92ebb5c2a92b64d49c826c8c485cae0c4ee8ade5 (patch) | |
tree | 270b350948943c397a4815e5600c17d4d9e81454 /server | |
parent | 06a6d3ef03c50f3733023a6eb9869d3f898ee670 (diff) | |
download | sonarqube-92ebb5c2a92b64d49c826c8c485cae0c4ee8ade5.tar.gz sonarqube-92ebb5c2a92b64d49c826c8c485cae0c4ee8ade5.zip |
SONAR-22303 Fix aria-label misuse (Deque issues #1744242 & #1744842)
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/activity-graph/RichQualityProfileEventInner.tsx | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx index eaa0ed1feaa..a5a8262743a 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx @@ -77,7 +77,9 @@ it('should render correctly', async () => { ).toBeInTheDocument(); await user.click( - screen.getByRole('link', { name: 'quality_profiles.page_title_changelog_x.QP-test' }), + screen.getByRole('link', { + name: 'quality_profiles.page_title_changelog_x.QP-test: 1 new rule, 2 modified rules, and 3 removed rules', + }), ); expect(await screen.findByText('QP-test java')).toBeInTheDocument(); diff --git a/server/sonar-web/src/main/js/components/activity-graph/RichQualityProfileEventInner.tsx b/server/sonar-web/src/main/js/components/activity-graph/RichQualityProfileEventInner.tsx index 806f25ce35c..b4307c09210 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/RichQualityProfileEventInner.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/RichQualityProfileEventInner.tsx @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { DiscreetLink } from 'design-system'; + +import { Link } from '@sonarsource/echoes-react'; import React from 'react'; import { useIntl } from 'react-intl'; import { getProfileChangelogPath } from '../../apps/quality-profiles/utils'; @@ -46,25 +47,29 @@ export function RichQualityProfileEventInner({ name, qualityProfile: { languageKey, name: qualityProfileName }, } = event; + const intl = useIntl(); const truncatedName = name.split(description)[0]; + const contextForAria = intl.formatMessage( + { id: 'quality_profiles.page_title_changelog_x' }, + { 0: qualityProfileName }, + ); + return ( <span aria-label={name}> {truncatedName} - <DiscreetLink - aria-label={intl.formatMessage( - { id: 'quality_profiles.page_title_changelog_x' }, - { 0: qualityProfileName }, - )} + + <Link + aria-label={`${contextForAria}: ${description}`} to={getProfileChangelogPath(qualityProfileName, languageKey)} // Needed to make this link work from the Activity tab // Because of a click handler on a parent component that is also trigerring a redirection onClick={(event) => event.stopPropagation()} > {description} - </DiscreetLink> + </Link> </span> ); } |