mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
In /app use the window to scroll to initial read position
There isn't a scrollElementRef in `/app` because there is no fixed header, so this will scroll the entire document instead.
This commit is contained in:
parent
88103cba9f
commit
463e569e57
1 changed files with 5 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue