forked from Mirrors/gomuks
web/roomlist: scroll entry to view when switching rooms
This commit is contained in:
parent
c5452a570e
commit
3df80686c4
2 changed files with 7 additions and 1 deletions
|
@ -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) => {
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue