Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0a881e2

Browse files
authored
Iterate landmarks around the app in order to improve a11y (#12064)
* Iterate landmarks around the app in order to improve a11y Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add missing aria-label Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update snapshots Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshots which have changed a fraction due to default heading margins being different in different landmarks Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent af31965 commit 0a881e2

25 files changed

Lines changed: 68 additions & 40 deletions

File tree

playwright/e2e/user-view/user-view.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test.describe("UserView", () => {
2525
test("should render the user view as expected", async ({ page, homeserver, user, bot }) => {
2626
await page.goto(`/#/user/${bot.credentials.userId}`);
2727

28-
const rightPanel = page.getByRole("complementary");
28+
const rightPanel = page.locator("#mx_RightPanel");
2929
await expect(rightPanel.getByRole("heading", { name: bot.credentials.displayName, exact: true })).toBeVisible();
3030
await expect(rightPanel.getByText("1 session")).toBeVisible();
3131
await expect(rightPanel).toMatchScreenshot("user-info.png", {

playwright/pages/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ export class Settings {
9090
}
9191

9292
/**
93-
* Open room settings (via room menu), returns a locator to the dialog
93+
* Open room settings (via room header menu), returns a locator to the dialog
9494
* @param tab the name of the tab to switch to after opening, optional.
9595
*/
9696
public async openRoomSettings(tab?: string): Promise<Locator> {
97-
await this.page.getByRole("main").getByRole("button", { name: "Room options", exact: true }).click();
97+
await this.page.getByRole("banner").getByRole("button", { name: "Room options", exact: true }).click();
9898
await this.page.locator(".mx_RoomTile_contextMenu").getByRole("menuitem", { name: "Settings" }).click();
9999
if (tab) await this.switchTab(tab);
100100
return this.page.locator(".mx_Dialog").filter({ has: this.page.locator(".mx_RoomSettingsDialog") });
201 Bytes
Loading
1.49 KB
Loading
2.69 KB
Loading
2.36 KB
Loading
98 Bytes
Loading

src/components/structures/LeftPanel.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ export default class LeftPanel extends React.Component<IProps, IState> {
315315
if (this.state.showBreadcrumbs === BreadcrumbsMode.Legacy && !this.props.isMinimized) {
316316
return (
317317
<IndicatorScrollbar
318+
role="navigation"
319+
aria-label={_t("a11y|recent_rooms")}
318320
className="mx_LeftPanel_breadcrumbsContainer mx_AutoHideScrollbar"
319321
verticalScrollsHorizontally={true}
320322
>
@@ -356,6 +358,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
356358
onFocus={this.onFocus}
357359
onBlur={this.onBlur}
358360
onKeyDown={this.onKeyDown}
361+
role="search"
359362
>
360363
<RoomSearch isMinimized={this.props.isMinimized} />
361364

@@ -397,7 +400,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
397400
selected={this.props.pageType === PageType.HomePage}
398401
minimized={this.props.isMinimized}
399402
/>
400-
<div className="mx_LeftPanel_roomListWrapper">
403+
<nav className="mx_LeftPanel_roomListWrapper" aria-label={_t("common|rooms")}>
401404
<div
402405
className={roomListClasses}
403406
ref={this.listContainerRef}
@@ -407,7 +410,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
407410
>
408411
{roomList}
409412
</div>
410-
</div>
413+
</nav>
411414
</div>
412415
</div>
413416
);

src/components/structures/LoggedInView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ class LoggedInView extends React.Component<IProps, IState> {
683683
<div className={bodyClasses}>
684684
<div className="mx_LeftPanel_outerWrapper">
685685
<LeftPanelLiveShareWarning isMinimized={this.props.collapseLhs || false} />
686-
<nav className="mx_LeftPanel_wrapper">
686+
<div className="mx_LeftPanel_wrapper">
687687
<BackdropPanel blurMultiplier={0.5} backgroundImage={this.state.backgroundImage} />
688688
<SpacePanel />
689689
<BackdropPanel backgroundImage={this.state.backgroundImage} />
@@ -698,7 +698,7 @@ class LoggedInView extends React.Component<IProps, IState> {
698698
resizeNotifier={this.props.resizeNotifier}
699699
/>
700700
</div>
701-
</nav>
701+
</div>
702702
</div>
703703
<ResizeHandle passRef={this.resizeHandler} id="lp-resizer" />
704704
<div className="mx_RoomView_wrapper">{pageElement}</div>

src/components/structures/RoomView.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
406406
private unmounted = false;
407407
private permalinkCreators: Record<string, RoomPermalinkCreator> = {};
408408

409-
private roomView = createRef<HTMLElement>();
409+
private roomView = createRef<HTMLDivElement>();
410410
private searchResultsPanel = createRef<ScrollPanel>();
411411
private messagePanel: TimelinePanel | null = null;
412412
private roomViewBody = createRef<HTMLDivElement>();
@@ -2302,7 +2302,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
23022302
// if statusBar does not exist then statusBarArea is blank and takes up unnecessary space on the screen
23032303
// show statusBarArea only if statusBar is present
23042304
const statusBarArea = statusBar && (
2305-
<div className={statusBarAreaClass}>
2305+
<div role="region" className={statusBarAreaClass} aria-label={_t("a11y|room_status_bar")}>
23062306
<div className="mx_RoomView_statusAreaBox">
23072307
<div className="mx_RoomView_statusAreaBox_line" />
23082308
{statusBar}
@@ -2528,13 +2528,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
25282528
<Measured sensor={this.roomViewBody.current} onMeasurement={this.onMeasurement} />
25292529
)}
25302530
{auxPanel}
2531-
<div className={timelineClasses}>
2531+
<main className={timelineClasses}>
25322532
<FileDropTarget parent={this.roomView.current} onFileDrop={this.onFileDrop} />
25332533
{topUnreadMessagesBar}
25342534
{jumpToBottom}
25352535
{messagePanel}
25362536
{searchResultsPanel}
2537-
</div>
2537+
</main>
25382538
{statusBarArea}
25392539
{previewBar}
25402540
{messageComposer}
@@ -2550,6 +2550,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
25502550
userId={this.context.client.getSafeUserId()}
25512551
resizeNotifier={this.props.resizeNotifier}
25522552
showApps={true}
2553+
role="main"
25532554
/>
25542555
{previewBar}
25552556
</>
@@ -2563,6 +2564,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
25632564
room={this.state.room}
25642565
resizing={this.state.resizing}
25652566
waitForCall={isVideoRoom(this.state.room)}
2567+
role="main"
25662568
/>
25672569
{previewBar}
25682570
</>
@@ -2603,7 +2605,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
26032605

26042606
return (
26052607
<RoomContext.Provider value={this.state}>
2606-
<main
2608+
<div
26072609
className={mainClasses}
26082610
ref={this.roomView}
26092611
onKeyDown={this.onReactKeyDown}
@@ -2655,7 +2657,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
26552657
</div>
26562658
</MainSplit>
26572659
</ErrorBoundary>
2658-
</main>
2660+
</div>
26592661
</RoomContext.Provider>
26602662
);
26612663
}

0 commit comments

Comments
 (0)