From 8b7eb8bb1da6946a570d47d1e602a1af65a167a9 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 15 May 2023 13:36:28 +0100 Subject: [PATCH] Fix aria-required-children axe violation (#10900) * Fix aria-required-children axe violation * Fix test selector --- cypress/e2e/invite/invite-dialog.spec.ts | 8 +++++--- src/components/views/rooms/RoomSublist.tsx | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/invite/invite-dialog.spec.ts b/cypress/e2e/invite/invite-dialog.spec.ts index dedea1fd2b..1553215ac0 100644 --- a/cypress/e2e/invite/invite-dialog.spec.ts +++ b/cypress/e2e/invite/invite-dialog.spec.ts @@ -47,9 +47,11 @@ describe("Invite dialog", function () { // Open the room info panel cy.findByRole("button", { name: "Room info" }).click(); - // Click "People" button on the panel - // Regex pattern due to the string of "mx_BaseCard_Button_sublabel" - cy.findByRole("button", { name: /People/ }).click(); + cy.get(".mx_RightPanel").within(() => { + // Click "People" button on the panel + // Regex pattern due to the string of "mx_BaseCard_Button_sublabel" + cy.findByRole("button", { name: /People/ }).click(); + }); cy.get(".mx_BaseCard_header").within(() => { // Click "Invite to this room" button diff --git a/src/components/views/rooms/RoomSublist.tsx b/src/components/views/rooms/RoomSublist.tsx index ccb3c77f8e..d6d59287a4 100644 --- a/src/components/views/rooms/RoomSublist.tsx +++ b/src/components/views/rooms/RoomSublist.tsx @@ -700,6 +700,10 @@ export default class RoomSublist extends React.Component { onKeyDown={this.onHeaderKeyDown} onFocus={onFocus} aria-label={this.props.label} + role="treeitem" + aria-expanded={this.state.isExpanded} + aria-level={1} + aria-selected="false" >
@@ -708,9 +712,7 @@ export default class RoomSublist extends React.Component { inputRef={ref} tabIndex={tabIndex} className="mx_RoomSublist_headerText" - role="treeitem" aria-expanded={this.state.isExpanded} - aria-level={1} onClick={this.onHeaderClick} onContextMenu={this.onContextMenu} title={this.props.isMinimized ? this.props.label : undefined}