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

Commit e099ebd

Browse files
authored
Fix click behavior of notification badges on spaces (#8627)
* Fix click behavior of notification badges on spaces * Fix import
1 parent d717d06 commit e099ebd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/views/spaces/SpaceTreeLevel.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React, { ComponentProps, ComponentType, createRef, InputHTMLAttributes, LegacyRef } from "react";
17+
import React, { MouseEvent, ComponentProps, ComponentType, createRef, InputHTMLAttributes, LegacyRef } from "react";
1818
import classNames from "classnames";
1919
import { Room, RoomEvent } from "matrix-js-sdk/src/models/room";
2020
import { DraggableProvidedDragHandleProps } from "react-beautiful-dnd";
@@ -84,9 +84,15 @@ export const SpaceButton: React.FC<IButtonProps> = ({
8484
ariaLabel = _t("Jump to first invite.");
8585
}
8686

87+
const jumpToNotification = (ev: MouseEvent) => {
88+
ev.stopPropagation();
89+
ev.preventDefault();
90+
SpaceStore.instance.setActiveRoomInSpace(spaceKey ?? space.roomId);
91+
};
92+
8793
notifBadge = <div className="mx_SpacePanel_badgeContainer">
8894
<NotificationBadge
89-
onClick={() => SpaceStore.instance.setActiveRoomInSpace(spaceKey ?? space.roomId)}
95+
onClick={jumpToNotification}
9096
forceCount={false}
9197
notification={notificationState}
9298
aria-label={ariaLabel}

0 commit comments

Comments
 (0)