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

core(gather-runner): always reset scroll position #8625

Merged
merged 7 commits into from
May 25, 2019

Conversation

patrickhulce
Copy link
Collaborator

Summary
Came up a few times now, but we should give gatherers a consistent view of the page. This PR saves the scroll position of the page after we're done loading and scrolls back to it after every gatherer.

Related Issues/PRs
#7778 (comment)

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a good idea? I don't see strong downsides. Is scrollTo a no-op if scrolling to where the page already is?

lighthouse-core/gather/driver.js Outdated Show resolved Hide resolved
lighthouse-core/gather/driver.js Show resolved Hide resolved
lighthouse-core/gather/driver.js Outdated Show resolved Hide resolved
@@ -319,6 +319,10 @@ class GatherRunner {
await driver.setThrottling(passContext.settings, {useThrottling: false});
log.time(apStatus, 'verbose');

// Some gatherers scroll the page which can cause unexpected results for other gatherers.
// We reset the scroll position in between each gatherer.
const scrollPosition = pageLoadError ? null : await driver.getScrollPosition();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pageLoadError control flow is seriously the worst :S

lighthouse-core/test/gather/driver-test.js Outdated Show resolved Hide resolved
Co-Authored-By: patrickhulce <patrick.hulce@gmail.com>
@paulirish
Copy link
Member

let's land this after we ship 5.0.0

@patrickhulce
Copy link
Collaborator Author

patrickhulce commented May 20, 2019

let's land this after we ship 5.0.0

It is now post-5.0.0, reviews welcome :)

@paulirish paulirish merged commit 6bc4f89 into master May 25, 2019
@paulirish paulirish deleted the reset_scroll_position branch May 25, 2019 05:21
@brendankenny
Copy link
Member

yeah, no, bad merge, bad :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants