fix: SideDrawer glitched element movement.

Even when using `onTransitionEnd`, the `scrollIntoView` problem persists.
The solution that i found is to use `requestAnimationFrame` two times,
turns out that's enough time after the component mounts to fix the problem.
This commit is contained in:
Abdalrzag Eisa 2025-06-14 23:18:08 +03:00
parent a0d3a50122
commit 5f106f49d3
No known key found for this signature in database
GPG key ID: 4CD5A78B36195BC8

View file

@ -80,9 +80,13 @@ const SideDrawer = memo(forwardRef<HTMLDivElement, Props>(({ seriesInfo, classNa
const jumpToPlayingNow = () => {
const { current } = selectedVideoRef;
if (current) {
current.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
if (!current) return;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
current.scrollIntoView({ behavior: 'smooth', block: 'center' });
});
});
};
return (