From: Ambroise Date: Mon, 9 Jan 2023 16:44:58 +0000 (+0100) Subject: SONAR-17845 Fix a11y issues X-Git-Tag: 9.9.0.65466~88 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3e48de517be3d38329631f7e0b245f1b7f3659ab;p=sonarqube.git SONAR-17845 Fix a11y issues Fix a11y issues: - [1099717] Certain ARIA roles must contain particular children - [1099818] Certain ARIA roles must be contained by particular parents - [1098592] Visual list is not marked up as list --- diff --git a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts index b14bf7de08d..ce418a36649 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts +++ b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts @@ -43,19 +43,19 @@ afterEach(() => handler.reset()); it('should select rules with keyboard navigation', async () => { const user = userEvent.setup(); renderCodingRulesApp(); - let row = await screen.findByRole('row', { selected: true }); - expect(within(row).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); + let listitem = await screen.findByRole('listitem', { current: true }); + expect(within(listitem).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); await user.keyboard('{ArrowDown}'); - row = await screen.findByRole('row', { selected: true }); - expect(within(row).getByRole('link', { name: 'Hot hotspot' })).toBeInTheDocument(); + listitem = await screen.findByRole('listitem', { current: true }); + expect(within(listitem).getByRole('link', { name: 'Hot hotspot' })).toBeInTheDocument(); await user.keyboard('{ArrowUp}'); - row = await screen.findByRole('row', { selected: true }); - expect(within(row).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); + listitem = await screen.findByRole('listitem', { current: true }); + expect(within(listitem).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); await user.keyboard('{ArrowRight}'); expect(screen.getByRole('heading', { level: 3, name: 'Awsome java rule' })).toBeInTheDocument(); await user.keyboard('{ArrowLeft}'); - row = await screen.findByRole('row', { selected: true }); - expect(within(row).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); + listitem = await screen.findByRole('listitem', { current: true }); + expect(within(listitem).getByRole('link', { name: 'Awsome java rule' })).toBeInTheDocument(); }); it('should open with permalink', async () => { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx index aca44a3de0d..b64b65adf42 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx @@ -647,7 +647,7 @@ export class App extends React.PureComponent { /> ) : ( <> -
+
    {rules.map((rule) => ( { selectedProfile={this.getSelectedProfile()} /> ))} -
+ {paging !== undefined && ( { const { rule, selected } = this.props; const allTags = [...(rule.tags || []), ...(rule.sysTags || [])]; return ( -
@@ -264,7 +263,7 @@ export default class RuleListItem extends React.PureComponent {
-
+ ); } } diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/App-test.tsx.snap index c063cd23eae..59f49c690c4 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/App-test.tsx.snap @@ -267,7 +267,7 @@ exports[`should render correctly: loaded 1`] = `
-
+
    -
+ -
+
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap index 7d0ea3c9c88..7b7869967f2 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/__snapshots__/RuleListItem-test.tsx.snap @@ -101,11 +101,10 @@ exports[`renderActions should render the deactivate button 1`] = ` `; exports[`should render correctly: default 1`] = ` -
-
+ `; exports[`should render correctly: with activation 1`] = ` -
-
+ `;