feat: scroll to top when jumping to the current page
This commit is contained in:
parent
82537f192b
commit
23bf7fd005
23 changed files with 235 additions and 132 deletions
|
|
@ -30,11 +30,10 @@ const PrimaryPageLayout = forwardRef(
|
|||
ref,
|
||||
() => ({
|
||||
scrollToTop: () => {
|
||||
if (isSmallScreen) {
|
||||
window.scrollTo({ top: 0 })
|
||||
return
|
||||
if (scrollAreaRef.current) {
|
||||
return scrollAreaRef.current.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}
|
||||
scrollAreaRef.current?.scrollTo({ top: 0 })
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
}
|
||||
}),
|
||||
[]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue