mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
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.client.store.activeRoomID = room?.roomID
|
||||||
this.keybindings.activeRoom = room
|
this.keybindings.activeRoom = room
|
||||||
|
if (roomID) {
|
||||||
|
document.querySelector(`div.room-entry[data-room-id="${CSS.escape(roomID)}"]`)
|
||||||
|
?.scrollIntoView({ block: "nearest" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clickRoom = (evt: React.MouseEvent) => {
|
clickRoom = (evt: React.MouseEvent) => {
|
||||||
|
|
|
@ -49,7 +49,9 @@ export const ReplyIDBody = ({ room, eventID, isThread }: ReplyIDBodyProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClickReply = (evt: React.MouseEvent) => {
|
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) {
|
if (targetEvt) {
|
||||||
targetEvt.scrollIntoView({
|
targetEvt.scrollIntoView({
|
||||||
block: "center",
|
block: "center",
|
||||||
|
|
Loading…
Add table
Reference in a new issue