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

Plans: scroll to the top when moving across pages #45933

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

rcanepa
Copy link
Contributor

@rcanepa rcanepa commented Sep 25, 2020

Changes proposed in this Pull Request

  • On mobile, if you move across pages, the scroll position doesn't get reset, which makes the experience confusing. This PR adds a reset in both the Details and the Upsell pages.

Testing instructions

  • Run this PR.
  • Configure your browser in mobile mode. We want a screen with a small viewport.
  • Visit the Plans page /plans/:site.
  • Test the flows of the following products (without going to checkout): Jetpack Security, Jetpack Backup, and Jetpack Scan.
  • Verify that every time you visit the Details page the scroll is reset to the top of the page.
  • Verify that every time you visit the Upsell page the scroll is reset to the top of the page.

Fixes 1169247016322522-as-1193973893888697

Demo

Before

Kapture 2020-09-25 at 11 05 49

After

Kapture 2020-09-25 at 11 02 02

@rcanepa rcanepa added Jetpack [Feature] Plans & Upgrades All of the plans on WordPress.com and flow for upgrading plans. [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Sep 25, 2020
@rcanepa rcanepa requested a review from a team September 25, 2020 14:07
@matticbot
Copy link
Contributor

Comment on lines +56 to +58
useEffect( () => {
window.scrollTo( 0, 0 );
}, [] );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To reset the scroll just after the first render.

Comment on lines +90 to +92
useEffect( () => {
window.scrollTo( 0, 0 );
}, [] );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To reset the scroll just after the first render.

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~109 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
plans                       +102 B  (+0.0%)      +36 B  (+0.0%)
jetpack-connect             +102 B  (+0.0%)      +37 B  (+0.0%)
jetpack-cloud-pricing       +102 B  (+0.0%)      +36 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@elliottprogrammer elliottprogrammer left a comment

Choose a reason for hiding this comment

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

Yes, works great. A much better experience, indeed!
LGTM! 👍

@rcanepa rcanepa merged commit 4d984bd into master Sep 28, 2020
@rcanepa rcanepa deleted the improve/scroll-to-top-in-plans-pages branch September 28, 2020 20:29
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Plans & Upgrades All of the plans on WordPress.com and flow for upgrading plans. Jetpack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants