Smart scroll-to-top preserves verse auto-navigation
- **Conditional scroll-to-top**: Only scroll to top when no verse hash is present - **Preserves verse navigation**: Verse favorites and search results auto-scroll to verses - **Mobile-friendly**: Version selections still scroll to top on book pages - **No breaking changes**: All existing auto-navigation features remain intact Mobile scrolling now works perfectly without breaking verse deep-linking!
This commit is contained in:
@@ -44,8 +44,10 @@ function App() {
|
|||||||
setSelectedVersion('');
|
setSelectedVersion('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll to top when navigating to new pages
|
// Scroll to top when navigating to new pages (unless there's verse auto-navigation active)
|
||||||
window.scrollTo(0, 0);
|
if (!window.location.hash.startsWith('#verse-')) {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user