From e0d6e34cc4d4888df0194354337ffe27d21868a7 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Mon, 29 Apr 2024 16:38:29 +0200 Subject: [PATCH 1/8] Update `ContextMenuTooltipButton.tsx` --- .../context_menu/ContextMenuTooltipButton.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/accessibility/context_menu/ContextMenuTooltipButton.tsx b/src/accessibility/context_menu/ContextMenuTooltipButton.tsx index 34986627601..994efb56422 100644 --- a/src/accessibility/context_menu/ContextMenuTooltipButton.tsx +++ b/src/accessibility/context_menu/ContextMenuTooltipButton.tsx @@ -18,9 +18,9 @@ limitations under the License. import React, { ComponentProps, forwardRef, Ref } from "react"; -import AccessibleTooltipButton from "../../components/views/elements/AccessibleTooltipButton"; +import AccessibleButton from "../../components/views/elements/AccessibleButton"; -type Props = ComponentProps> & { +type Props = ComponentProps> & { // whether the context menu is currently open isExpanded: boolean; }; @@ -31,16 +31,17 @@ export const ContextMenuTooltipButton = forwardRef(function , ) { return ( - {children} - + ); }); From 0d349ca76ab35c54d7339c49990f129dc16e804b Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Mon, 29 Apr 2024 17:07:18 +0200 Subject: [PATCH 2/8] Fix placement --- src/components/views/rooms/LegacyRoomHeader.tsx | 2 +- .../views/voip/LegacyCallView/LegacyCallViewButtons.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/LegacyRoomHeader.tsx b/src/components/views/rooms/LegacyRoomHeader.tsx index 5fab692046d..87409203e12 100644 --- a/src/components/views/rooms/LegacyRoomHeader.tsx +++ b/src/components/views/rooms/LegacyRoomHeader.tsx @@ -754,7 +754,7 @@ export default class RoomHeader extends React.Component { onClick={this.onContextMenuOpenClick} isExpanded={!!this.state.contextMenuPosition} title={_t("room|context_menu|title")} - alignment={Alignment.Bottom} + placement="bottom" > {roomName} {this.props.room &&
} diff --git a/src/components/views/voip/LegacyCallView/LegacyCallViewButtons.tsx b/src/components/views/voip/LegacyCallView/LegacyCallViewButtons.tsx index fd8c85874ed..cf9c88c907f 100644 --- a/src/components/views/voip/LegacyCallView/LegacyCallViewButtons.tsx +++ b/src/components/views/voip/LegacyCallView/LegacyCallViewButtons.tsx @@ -265,7 +265,7 @@ export default class LegacyCallViewButtons extends React.Component )} )} Date: Mon, 29 Apr 2024 17:47:25 +0200 Subject: [PATCH 3/8] Update tests --- .../__snapshots__/DateSeparator-test.tsx.snap | 1 + test/components/views/rooms/RoomList-test.tsx | 16 ++++++++-------- .../rooms/__snapshots__/RoomTile-test.tsx.snap | 8 ++++++++ .../__snapshots__/SpacePanel-test.tsx.snap | 1 + 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap b/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap index 2294a40a995..b75f507bf2e 100644 --- a/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap +++ b/test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap @@ -42,6 +42,7 @@ exports[`DateSeparator when feature_jump_to_date is enabled renders the date sep aria-haspopup="true" aria-label="Jump to date" class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent" + data-state="closed" data-testid="jump-to-date-separator-button" role="button" tabindex="0" diff --git a/test/components/views/rooms/RoomList-test.tsx b/test/components/views/rooms/RoomList-test.tsx index d92b25e347c..93275776137 100644 --- a/test/components/views/rooms/RoomList-test.tsx +++ b/test/components/views/rooms/RoomList-test.tsx @@ -89,10 +89,10 @@ describe("RoomList", () => { const { rerender } = render(getComponent()); const roomsList = screen.getByRole("group", { name: "Rooms" }); - const addRoomButton = within(roomsList).getByRole("button", { name: "Add room" }); + const getAddRoomButton = () => within(roomsList).getByRole("button", { name: "Add room" }); expect(screen.queryByRole("menu")).not.toBeInTheDocument(); - await userEvent.click(addRoomButton); + await userEvent.click(getAddRoomButton()); const menu = screen.getByRole("menu"); @@ -102,7 +102,7 @@ describe("RoomList", () => { disabled = [UIComponent.CreateRooms]; rerender(getComponent()); - expect(addRoomButton).toBeInTheDocument(); + expect(getAddRoomButton()).toBeInTheDocument(); expect(menu).toBeInTheDocument(); expect(within(menu).queryByRole("menuitem", { name: "New room" })).not.toBeInTheDocument(); expect(within(menu).getByRole("menuitem", { name: "Explore public rooms" })).toBeInTheDocument(); @@ -110,7 +110,7 @@ describe("RoomList", () => { disabled = [UIComponent.ExploreRooms]; rerender(getComponent()); - expect(addRoomButton).toBeInTheDocument(); + expect(getAddRoomButton()).toBeInTheDocument(); expect(menu).toBeInTheDocument(); expect(within(menu).getByRole("menuitem", { name: "New room" })).toBeInTheDocument(); expect(within(menu).queryByRole("menuitem", { name: "Explore public rooms" })).not.toBeInTheDocument(); @@ -163,10 +163,10 @@ describe("RoomList", () => { const { rerender } = render(getComponent()); const roomsList = screen.getByRole("group", { name: "Rooms" }); - const addRoomButton = within(roomsList).getByRole("button", { name: "Add room" }); + const getAddRoomButton = () => within(roomsList).getByRole("button", { name: "Add room" }); expect(screen.queryByRole("menu")).not.toBeInTheDocument(); - await userEvent.click(addRoomButton); + await userEvent.click(getAddRoomButton()); const menu = screen.getByRole("menu"); @@ -177,7 +177,7 @@ describe("RoomList", () => { disabled = [UIComponent.CreateRooms]; rerender(getComponent()); - expect(addRoomButton).toBeInTheDocument(); + expect(getAddRoomButton()).toBeInTheDocument(); expect(menu).toBeInTheDocument(); expect(within(menu).getByRole("menuitem", { name: "Explore rooms" })).toBeInTheDocument(); expect(within(menu).queryByRole("menuitem", { name: "New room" })).not.toBeInTheDocument(); @@ -186,7 +186,7 @@ describe("RoomList", () => { disabled = [UIComponent.ExploreRooms]; rerender(getComponent()); - expect(addRoomButton).toBeInTheDocument(); + expect(getAddRoomButton()).toBeInTheDocument(); expect(menu).toBeInTheDocument(); expect(within(menu).queryByRole("menuitem", { name: "Explore rooms" })).toBeInTheDocument(); expect(within(menu).getByRole("menuitem", { name: "New room" })).toBeInTheDocument(); diff --git a/test/components/views/rooms/__snapshots__/RoomTile-test.tsx.snap b/test/components/views/rooms/__snapshots__/RoomTile-test.tsx.snap index 0a96c2cc650..e15e73bba59 100644 --- a/test/components/views/rooms/__snapshots__/RoomTile-test.tsx.snap +++ b/test/components/views/rooms/__snapshots__/RoomTile-test.tsx.snap @@ -59,6 +59,7 @@ exports[`RoomTile when message previews are enabled and there is a message in a aria-haspopup="true" aria-label="Room options" class="mx_AccessibleButton mx_RoomTile_menuButton" + data-state="closed" role="button" tabindex="0" /> @@ -67,6 +68,7 @@ exports[`RoomTile when message previews are enabled and there is a message in a aria-haspopup="true" aria-label="Notification options" class="mx_AccessibleButton mx_RoomTile_notificationsButton" + data-state="closed" role="button" tabindex="-1" /> @@ -141,6 +143,7 @@ exports[`RoomTile when message previews are enabled and there is a message in th aria-haspopup="true" aria-label="Room options" class="mx_AccessibleButton mx_RoomTile_menuButton" + data-state="closed" role="button" tabindex="0" /> @@ -149,6 +152,7 @@ exports[`RoomTile when message previews are enabled and there is a message in th aria-haspopup="true" aria-label="Notification options" class="mx_AccessibleButton mx_RoomTile_notificationsButton" + data-state="closed" role="button" tabindex="-1" /> @@ -204,6 +208,7 @@ exports[`RoomTile when message previews are enabled should render a room without aria-haspopup="true" aria-label="Room options" class="mx_AccessibleButton mx_RoomTile_menuButton" + data-state="closed" role="button" tabindex="0" /> @@ -212,6 +217,7 @@ exports[`RoomTile when message previews are enabled should render a room without aria-haspopup="true" aria-label="Notification options" class="mx_AccessibleButton mx_RoomTile_notificationsButton" + data-state="closed" role="button" tabindex="-1" /> @@ -266,6 +272,7 @@ exports[`RoomTile when message previews are not enabled should render the room 1 aria-haspopup="true" aria-label="Room options" class="mx_AccessibleButton mx_RoomTile_menuButton" + data-state="closed" role="button" tabindex="0" /> @@ -274,6 +281,7 @@ exports[`RoomTile when message previews are not enabled should render the room 1 aria-haspopup="true" aria-label="Notification options" class="mx_AccessibleButton mx_RoomTile_notificationsButton" + data-state="closed" role="button" tabindex="-1" /> diff --git a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap index 24412b1f779..e047e071469 100644 --- a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap @@ -77,6 +77,7 @@ exports[` should show all activated MetaSpaces in the correct orde aria-haspopup="true" aria-label="Options" class="mx_AccessibleButton mx_SpaceButton_menuButton" + data-state="closed" role="button" tabindex="0" /> From 18165a9388f82df0d54fbf09433ad56fa2b39c92 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 2 May 2024 16:45:55 +0200 Subject: [PATCH 4/8] Update space panel snapshot --- .../views/spaces/__snapshots__/SpacePanel-test.tsx.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap index ca3f79525e5..623fc96c40f 100644 --- a/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/SpacePanel-test.tsx.snap @@ -230,8 +230,8 @@ exports[` should show all activated MetaSpaces in the correct orde class="mx_ThreadsActivityCentre_container" >