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

Glitchy scroll on mobile #1155

Closed
SimenB opened this issue Dec 11, 2018 · 7 comments
Closed

Glitchy scroll on mobile #1155

SimenB opened this issue Dec 11, 2018 · 7 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR.

Comments

@SimenB
Copy link
Contributor

SimenB commented Dec 11, 2018

🐛 Bug Report

Scrolling quickly up and down with a menu open on mobile shows the underlying content at the bottom of the viewport. See reduxjs/redux#3292, but this is reproducible on Docusaurus' own website

Have you read the Contributing Guidelines on issues?

Yup

To Reproduce

(Write your steps here:)

  1. Chrome 71 (on pixel 3 xl, if it matters), with Duet enabled
  2. Open up a menu on e.g. https://docusaurus.io/docs/en/installation.
  3. Scroll quickly up and down

Expected behavior

No glitching

Actual Behavior

See gif on linked issue.

Reproducible Demo

This project's own website reproduces for me.

(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)

@fiennyangeln
Copy link
Contributor

@SimenB I can reproduce the above using iPhone X / 7 (both are Chrome 71) / Firefox desktop mobile mode (since I dont have Pixel3 at hand) but using different steps. So here is what I do to reproduce the gif linked for redux.js.org

  1. Click on the API word as shown below

image

2. Click on the menu bar on the right side

image

3. The empty looking site body

image

Do you think it is similar?

@endiliey endiliey added help wanted Asking for outside help and/or contributions to this particular issue or PR. bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. labels May 14, 2019
@shakcho
Copy link
Contributor

shakcho commented May 17, 2019

@endiliey The issue has nothing do with Scroll, The Issue is actually

<nav class="onPageNav"></nav>

element has no child element in it, and also

<div class="tocToggler" id="tocToggler">
    <i class="icon-toc"></i>
</div>

is present in the DOM, and beacause of that when someone Clicks on it(#tocToggler) toggles toActive class and it applies bellow CSS

@media only screen and (max-width: 1023px){
.tocActive .onPageNav {
    background: #fff;
    bottom: 0;
    display: block;
    left: 0;
    overflow-y: auto;
    -ms-scroll-chaining: none;
    overscroll-behavior: contain;
    padding: 0 20px;
    position: fixed;
    right: 0;
    top: 148px;
    z-index: 10;
 }
}

which renders the White layout on top of the main container, hence the issue is happening when there is not child element in <nav class="onPageNav">.
Screenshot attached.

1.See onNavPage has no child Element.
Screenshot 2019-05-18 at 1 06 34 AM

  1. On click of the #tocToggler the toActive class gets added and above mention, style gets applied.

Screenshot 2019-05-18 at 1 05 47 AM

  1. Code toggles the toActive class

Screenshot 2019-05-18 at 1 03 41 AM

I would like to solve the issue, but I want to know what will be expected behavior.

One solution I can think of is to not to render the <div class="tocToggler" id="tocToggler"> if <nav class="onPageNav"> has no child element in it .

Please let me know if my approach is correct.

@endiliey
Copy link
Contributor

I think the problem is that there is a content at the bottom of the viewport
A5FDC85F-7B9E-4E5D-B027-5D04751AD297

@shakcho
Copy link
Contributor

shakcho commented May 18, 2019

The visible content is actually part of the main container and not of onPageNav, but it showing because of onPageNav has a 40px Margin in the bottom.
Screenshot 2019-05-18 at 10 22 13 AM

Need to add the margin-bottom: 0 in case of mobile view
Screenshot 2019-05-18 at 10 25 23 AM

@endiliey
Copy link
Contributor

Yes. Do you want to send a PR ? 🔥🔥🔥

I think that’s what this issue is about.
And it will be nice to not display the TOC on mobile if there is no child content. Clicking something and only seeing a white layout isnt a good idea

@shakcho
Copy link
Contributor

shakcho commented May 18, 2019

Yes, I will send a PR ASAP for both.

@endiliey
Copy link
Contributor

#1489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. help wanted Asking for outside help and/or contributions to this particular issue or PR.
Projects
None yet
Development

No branches or pull requests

5 participants