diff --git a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx index 6d64af4650..8a2f00496b 100644 --- a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx +++ b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx @@ -1,5 +1,5 @@ /* -Copyright 2021-2022 The Matrix.org Foundation C.I.C. +Copyright 2021 - 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -624,6 +624,8 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n clientRoom?.getMyMembership() === "join" || result.publicRoom.world_readable || cli.isGuest(); const listener = (ev: ButtonEvent): void => { + ev.stopPropagation(); + const { publicRoom } = result; viewRoom( { diff --git a/test/components/views/dialogs/SpotlightDialog-test.tsx b/test/components/views/dialogs/SpotlightDialog-test.tsx index 2cc95324ff..e587ffbe5c 100644 --- a/test/components/views/dialogs/SpotlightDialog-test.tsx +++ b/test/components/views/dialogs/SpotlightDialog-test.tsx @@ -1,5 +1,5 @@ /* -Copyright 2022 The Matrix.org Foundation C.I.C. +Copyright 2022 - 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -376,7 +376,8 @@ describe("Spotlight Dialog", () => { expect(options.length).toBe(1); expect(options[0].innerHTML).toContain(testPublicRoom.name); - fireEvent.click(options[0]!); + fireEvent.click(options[0].querySelector("[role='button']")!); + expect(defaultDispatcher.dispatch).toHaveBeenCalledTimes(1); expect(defaultDispatcher.dispatch).toHaveBeenCalledWith( expect.objectContaining({ action: "view_room",