Keep note list mounted off-screen on mobile to perfectly preserve scroll position

This commit is contained in:
chrisf committed 2026-10-22 17:28:31 -06:00
1 parent e1a861faea
commit 2f14f48ac1
1 file changed
+7 -6
+7 -6
View File
@@ -578,15 +578,16 @@ export default function EvercloneWorkspace() {
useEffect(() => {
if (mobilePane === 'list' && listParentRef.current) {
const targetScroll = listScrollPosRef.current;
// Also ensure window itself is at top (prevent browser auto-scroll offset)
if (typeof window !== 'undefined') {
window.scrollTo(0, 0);
}
requestAnimationFrame(() => {
// Use double rAF / timeout to ensure browser layout and virtualizer are completely settled
const timer = setTimeout(() => {
if (listParentRef.current) {
listParentRef.current.scrollTop = targetScroll;
}
});
}, 30);
return () => clearTimeout(timer);
}
}, [mobilePane]);
@@ -1479,9 +1480,9 @@ export default function EvercloneWorkspace() {
<>
{/* 2. MIDDLE NOTE LIST PANE */}
<section
className={`${
mobilePane === 'editor' ? 'hidden md:flex' : 'flex'
} w-full ${
className={`w-full ${
mobilePane === 'editor' ? 'max-md:invisible max-md:absolute max-md:-left-[9999px] max-md:pointer-events-none' : 'flex'
} ${
listMode === 'cards'
? 'md:w-96 lg:w-[460px] xl:w-[500px]'
: 'md:w-80 lg:w-96'