Merge pull request #247 from omnivore-app/fix/app-scrolling

In /app use the window to scroll to initial read position
This commit is contained in:
Jackson Harper 2022-03-16 14:07:16 -07:00 committed by GitHub
commit 3d5a61285c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,7 +151,11 @@ export function Article(props: ArticleProps): JSX.Element {
return 0
}
props.scrollElementRef.current?.scroll(0, calculateOffset(anchorElement))
if (props.scrollElementRef.current) {
props.scrollElementRef.current?.scroll(0, calculateOffset(anchorElement))
} else {
window.document.documentElement.scroll(0, calculateOffset(anchorElement))
}
}
}, [
props.initialAnchorIndex,