fix(mobile): improve scroll restoration, media gesture swipe, 5-digit otp, persistent cooldown and modal android back navigation
This commit is contained in:
1 parent
00cfd1a2a0
commit
1d2d141514
16 files changed
+12610
-11527
No files matched your search
@@ -58,10 +58,28 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
|
||||
}
|
||||
}, [fetchProfile, fetchSettings]);
|
||||
|
||||
// Scroll to top on navigation / pathname change
|
||||
// Track navigation type (push vs pop) to allow smooth scroll restoration on Back/Forward
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined') return;
|
||||
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
||||
|
||||
let popstateTriggered = false;
|
||||
const handlePopState = () => {
|
||||
popstateTriggered = true;
|
||||
};
|
||||
|
||||
window.addEventListener('popstate', handlePopState);
|
||||
|
||||
// Give microtask/frame for popstate event to register before checking
|
||||
const timeoutId = setTimeout(() => {
|
||||
if (!popstateTriggered) {
|
||||
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
||||
}
|
||||
}, 0);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('popstate', handlePopState);
|
||||
clearTimeout(timeoutId);
|
||||
};
|
||||
}, [pathname]);
|
||||
|
||||
// Check Maintenance Mode (Admin / Partner bypass)
|
||||
|
||||
Reference in new issue
Block a user