From 36a39f7fd6828b04db61fb4b932d28b2dd7ba78e Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 11 Jun 2026 18:14:36 +0200 Subject: [PATCH] Room list: fix keyboard navigation on sections (#33809) * fix: keyboard navigation on sections * test: add e2e test for keyboard navigation * fix: add more keyboard navigation * test: add e2e tests * chore: remove useless check --- .../room-list-sections.spec.ts | 127 ++++++++++++++++++ .../RoomListItemWrapper.test.tsx | 61 +++++++++ .../RoomListItemWrapper.tsx | 19 ++- .../RoomListSectionHeaderView.module.css | 7 +- .../RoomListSectionHeaderView.test.tsx | 72 +++++++++- .../RoomListSectionHeaderView.tsx | 37 ++++- 6 files changed, 311 insertions(+), 12 deletions(-) create mode 100644 packages/shared-components/src/room-list/VirtualizedRoomListView/RoomListItemWrapper/RoomListItemWrapper.test.tsx diff --git a/apps/web/playwright/e2e/left-panel/room-list-panel/room-list-sections.spec.ts b/apps/web/playwright/e2e/left-panel/room-list-panel/room-list-sections.spec.ts index 14256cf645..e1ef31e92f 100644 --- a/apps/web/playwright/e2e/left-panel/room-list-panel/room-list-sections.spec.ts +++ b/apps/web/playwright/e2e/left-panel/room-list-panel/room-list-sections.spec.ts @@ -290,4 +290,131 @@ test.describe("Room list sections", () => { await expect(roomList.getByRole("row", { name: "no unread room" })).not.toBeVisible(); }); }); + + test.describe("Section keyboard navigation", () => { + test.beforeEach(async ({ app }) => { + // A favourite room forces section mode and gives us a non-trivial first section. + const favouriteId = await app.client.createRoom({ name: "favourite room" }); + await app.client.evaluate(async (client, roomId) => { + await client.setRoomTag(roomId, "m.favourite"); + }, favouriteId); + + // A chats-section room so we have a second section to navigate to. + await app.client.createRoom({ name: "chat room" }); + }); + + test("Arrow Down/Up move focus through sections and rooms", async ({ page }) => { + const roomList = getRoomList(page); + const favouritesHeader = getSectionHeader(page, "Favourites"); + // In treegrid mode, a room renders as
. + // Only the inner