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

Add scroll margin for login and recover pages #606

Merged
merged 1 commit into from
Sep 10, 2021
Merged

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Sep 9, 2021

Why are these changes introduced?

Fixes #358

What approach did you take?

The issue is caused by the no-js approach we're taking on this page. We're using the :target selector to hide/show the login and recover forms with anchor links/fragments. It is default browser behavior to snap the scroll to targeted element.

The easiest solution is to use scroll-margin-top property to offset where the browser snaps to.

Other considerations

The latest versions of all browsers support scroll-margin-top, but recent versions safari have a bug that prevent the prop from applying to fragment targets like we need. See caniuse. Given that the experience isn't necessarily "broken" without this fix I think current support is acceptable versus implementing some javascript to handle it more consistently.

Demo links

Checklist

@kmeleta kmeleta marked this pull request as ready for review September 9, 2021 21:01
@@ -338,7 +338,7 @@
}

#recover:target {
display: inline;
display: block;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This being inline seemed to prevent the scroll margin from working correctly in some browsers.

@tauthomas01 tauthomas01 self-assigned this Sep 10, 2021
@ludoboludo ludoboludo self-requested a review September 10, 2021 17:27
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@kmeleta kmeleta merged commit a70083d into main Sep 10, 2021
@kmeleta kmeleta deleted the login-scroll-fix branch September 10, 2021 18:11
@martinamarien martinamarien mentioned this pull request Sep 13, 2021
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
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.

Jumpy Log In / Password Reset Pages
3 participants