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

Fix click behavior of notification badges on spaces #8627

Merged
merged 2 commits into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/views/spaces/SpaceTreeLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

const jumpToNotification = (ev: MouseEvent) => {
ev.stopPropagation();
ev.preventDefault();
SpaceStore.instance.setActiveRoomInSpace(spaceKey ?? space.roomId);
};

notifBadge = <div className="mx_SpacePanel_badgeContainer">
<NotificationBadge
onClick={() => SpaceStore.instance.setActiveRoomInSpace(spaceKey ?? space.roomId)}
onClick={jumpToNotification}
forceCount={false}
notification={notificationState}
aria-label={ariaLabel}
Expand Down