diff --git a/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts b/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts index 0b6aa340293..f1247b038bb 100644 --- a/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts +++ b/playwright/e2e/left-panel/room-list-panel/room-list.spec.ts @@ -252,6 +252,26 @@ test.describe("Room list", () => { // Focus should be back on the notification button await expect(notificationButton).toBeFocused(); }); + + test("should navigate to the top and then bottom of the room list", async ({ page, app, user }) => { + const roomListView = getRoomList(page); + + const topRoom = roomListView.getByRole("option", { name: "Open room room29" }); + + // open the room + await topRoom.click(); + // put focus back on the room list item + await topRoom.click(); + await expect(topRoom).toBeFocused(); + + await page.keyboard.press("End"); + const bottomRoom = roomListView.getByRole("option", { name: "Open room room0" }); + await expect(bottomRoom).toBeFocused(); + + await page.keyboard.press("Home"); + const topRoomAgain = roomListView.getByRole("option", { name: "Open room room29" }); + await expect(topRoomAgain).toBeFocused(); + }); }); }); diff --git a/src/components/utils/ListView.tsx b/src/components/utils/ListView.tsx index 235a706a550..f99b7ab9441 100644 --- a/src/components/utils/ListView.tsx +++ b/src/components/utils/ListView.tsx @@ -133,13 +133,13 @@ export function ListView(props: IListViewProps { + setTabIndexKey(key); isScrollingToItem.current = false; }, });