Skip to content

fix: sidebar scrolling on ios devices#1161

Closed
teimurjan wants to merge 1 commit intofacebook:masterfrom
teimurjan:fix-sidebar-scrolling
Closed

fix: sidebar scrolling on ios devices#1161
teimurjan wants to merge 1 commit intofacebook:masterfrom
teimurjan:fix-sidebar-scrolling

Conversation

@teimurjan
Copy link
Contributor

Motivation

Fix #877. The reason of the bug is specification of Safari on iOS devices. If for the Chrome is enough just to add overflow: hidden for the body, for Safari it does not work till you set the position: fixed;. But in this way you lose your scrolling position. So I created a closure which saves the last scroll position in order to set it back when the sidebar is closed.

Have you read the Contributing Guidelines on pull requests?

Yes.

Test Plan

First tab is the scolling before the fix. The second one is after.

pull

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 19, 2018
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit aa26620

https://deploy-preview-1161--docusaurus-preview.netlify.com

@teimurjan
Copy link
Contributor Author

@yangshun Can someone check it, please?

}

function isIOS() {
var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I can only comment from code perspective, but this part can definitely be refactored with something like

iosDevices.indexOf(navigator.platform)

instead of the whole pop and while loop.

This also doesn't completely fix #877. #877 is related to glitchy scrolling on Mac Safari too. I don't have a Mac to test it out, unfortunately

cc @yangshun @JoelMarcey

@endiliey
Copy link
Contributor

Thank you for the effort but we're not going forward with this. I don't think this is the right fix because the bug is also happening on mac

Closing it due to stale activity as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Left nav sometime can't scroll on Safari

5 participants