Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Fix a bug with [scroll-region] elements not restoring correct scroll positions in react adapter #1796

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export class Router {

protected restoreScrollPositions(): void {
if (this.page.scrollRegions) {
this.scrollRegions().forEach((region: Element, index: number) => {
// Similar to the above, we're using setTimeout to fix a bug in the React adapter where
// the rendering isn't fast enough, causing incorrect scroll positions in [scroll-region] elements.
setTimeout(() => this.scrollRegions().forEach((region: Element, index: number) => {
const scrollPosition = this.page.scrollRegions[index]
if (!scrollPosition) {
return
Expand All @@ -146,7 +148,7 @@ export class Router {
region.scrollTop = scrollPosition.top
region.scrollLeft = scrollPosition.left
}
})
}))
}
}

Expand Down
Loading