diff --git a/frontend/src/app/stories/[id]/page.tsx b/frontend/src/app/stories/[id]/page.tsx index 6b01530..b7c2146 100644 --- a/frontend/src/app/stories/[id]/page.tsx +++ b/frontend/src/app/stories/[id]/page.tsx @@ -140,10 +140,14 @@ export default function StoryReadingPage() { // Calculate target scroll position const targetScroll = contentTop + (ratio * contentHeight) - (windowHeight * 0.3); - // Smooth scroll to position + // Use smooth scrolling only for shorter stories (< 15 000 words). + // For longer stories the saved position can be 50 000+ px from the top; + // browsers animate smooth-scroll at ~1 000–1 500 px/s, so the animation + // would take tens of seconds and often stalls or cancels before finishing. + const scrollBehavior = (story.wordCount ?? 0) < 15000 ? 'smooth' : 'instant'; window.scrollTo({ top: Math.max(0, targetScroll), - behavior: 'smooth' + behavior: scrollBehavior }); setHasScrolledToPosition(true); diff --git a/frontend/src/components/collections/CollectionReadingView.tsx b/frontend/src/components/collections/CollectionReadingView.tsx index c3c0de7..24b524b 100644 --- a/frontend/src/components/collections/CollectionReadingView.tsx +++ b/frontend/src/components/collections/CollectionReadingView.tsx @@ -70,10 +70,14 @@ export default function CollectionReadingView({ // Calculate target scroll position const targetScroll = contentTop + (ratio * contentHeight) - (windowHeight * 0.3); - // Smooth scroll to position + // Use smooth scrolling only for shorter stories (< 15 000 words). + // For longer stories the saved position can be 50 000+ px from the top; + // browsers animate smooth-scroll at ~1 000–1 500 px/s, so the animation + // would take tens of seconds and often stalls or cancels before finishing. + const scrollBehavior = (story.wordCount ?? 0) < 15000 ? 'smooth' : 'instant'; window.scrollTo({ top: Math.max(0, targetScroll), - behavior: 'smooth' + behavior: scrollBehavior }); setHasScrolledToPosition(true);