diff --git a/web/src/ui/MainScreen.tsx b/web/src/ui/MainScreen.tsx index 316b5f5..34c01f5 100644 --- a/web/src/ui/MainScreen.tsx +++ b/web/src/ui/MainScreen.tsx @@ -56,6 +56,10 @@ class ContextFields implements MainScreenContextFields { } this.client.store.activeRoomID = room?.roomID this.keybindings.activeRoom = room + if (roomID) { + document.querySelector(`div.room-entry[data-room-id="${CSS.escape(roomID)}"]`) + ?.scrollIntoView({ block: "nearest" }) + } } clickRoom = (evt: React.MouseEvent) => { diff --git a/web/src/ui/timeline/ReplyBody.tsx b/web/src/ui/timeline/ReplyBody.tsx index 5e5f698..8eac960 100644 --- a/web/src/ui/timeline/ReplyBody.tsx +++ b/web/src/ui/timeline/ReplyBody.tsx @@ -49,7 +49,9 @@ export const ReplyIDBody = ({ room, eventID, isThread }: ReplyIDBodyProps) => { } const onClickReply = (evt: React.MouseEvent) => { - const targetEvt = document.querySelector(`div[data-event-id="${evt.currentTarget.getAttribute("data-reply-to")}"]`) + const targetEvt = document.querySelector( + `div[data-event-id="${CSS.escape(evt.currentTarget.getAttribute("data-reply-to") ?? "")}"]`, + ) if (targetEvt) { targetEvt.scrollIntoView({ block: "center",