Open source video conferencing app powered by LiveKit. Built with Django and React.
✨(frontend) fix focus scroll jump during side panel animation
Cyril90c0442d357c
diff --git a/src/frontend/src/features/rooms/livekit/prefabs/Chat.tsx b/src/frontend/src/features/rooms/livekit/prefabs/Chat.tsxindex ddc5983d..7c4e67f4 100644--- a/src/frontend/src/features/rooms/livekit/prefabs/Chat.tsx+++ b/src/frontend/src/features/rooms/livekit/prefabs/Chat.tsx@@ -48,14 +48,17 @@ export function Chat({ ...props }: ChatProps) {// Chat just openedif (!wasChatOpen && isChatPanelOpen) {chatTriggerRef.current = document.activeElement as HTMLElement | null- inputRef.current?.focus()+ // Avoid layout "jump" during the side panel slide-in animation.+ // Focusing can trigger scroll into view; preventScroll keeps the animation smooth.+ requestAnimationFrame(() => {+ inputRef.current?.focus({ preventScroll: true })+ })}-// Chat just closedif (wasChatOpen && !isChatPanelOpen) {const trigger = chatTriggerRef.currentif (trigger && document.contains(trigger)) {- trigger.focus()+ trigger.focus({ preventScroll: true })}chatTriggerRef.current = null}@@ -72,7 +75,7 @@ export function Chat({ ...props }: ChatProps) {async function handleSubmit(text: string) {if (!send || !text) returnawait send(text)- inputRef?.current?.focus()+ inputRef?.current?.focus({ preventScroll: true })}// TEMPORARY: This is a brittle workaround that relies on message count tracking