-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(fr): preserve scroll position in gatherers #14660
Conversation
nice, yeah i like that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only problem with this approach currently is that if the gatherer code errors, the position won't be restored. Previously it would have been. Certainly there are times when we've seen Axe throw an error, so we should account for this.
FWIW that was added in #8625 so gatherers didn't have to worry about previous gatherers cleaning up after themselves and we wouldn't have to worry about remembering to make gatherers clean up after themselves. At first glance restoring scroll position after a gatherer seems like a pretty lightweight cleanup step. If the issue is that any |
Personally I think it's a good exercise to have gatherers clean up after themselves, especially if we're trying to be mindful of how a gatherer affects page state during a flow. #8625 was before my time and I only found out about it because I was investigating the
This is a good question. My best guess is that we run into errors when |
This functionality was never brought from legacy navs into FR so we should be consistent. Also, preserving the scroll position will at least be less destructive during flows (#14336).
Additionally, we don't need to restore the scroll position after every gatherer, only tap targets and a11y. I've noticed some issues when we try to restore the scroll position immediately after the bfcache gatherer in legacy mode.
Moving the scroll position restoration inside the tap targets and a11y gatherers achieves both of these goals.