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

bug(sidenav): Scroll locking and jumpy for md-sidenav content on iOS (Safari) #5606

Closed
YeomansIII opened this issue Jul 8, 2017 · 8 comments
Assignees

Comments

@YeomansIII
Copy link
Contributor

Bug

What is the expected behavior?

Content inside md-sidenav-container should scroll smoothly all the time.

What is the current behavior?

Content inside md-sidenav-container can lock and disallow scrolling. This continues until the page is given time to sit without interaction.

Demonstration
safari_scroll_issue

What are the steps to reproduce?

This can be seen happening on the material.angular.io Components page on iOS in Safari.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular: ^4.0.0
Material: beta.8
iOS 10, Safari

@macjohnny
Copy link
Contributor

@YeomansIII this is a general problem of scrolling an element with overflow: auto on iOS devices.
The problem arises when trying to scroll an element with scrollable content that currently has scrollTop = 0 in the direction that does not reveal further content. In that case, the browser will try to scroll the entire page and will handle this scrolling interaction until no further user input is received.

A way to solve this issue is by listening to the touchmove event and in case the move direction is "wrong", i.e. in the direction with no further content, the event has to be cancelled with Event.preventDefault()

@maciejtreder
Copy link

On my end it is working 90% correctly. The only one case, when I run into issue with scrolling side-nav layout in ios, is when using dynamically added content:

<div *ngIf="someConditional">content</img>

@tiancovici
Copy link

tiancovici commented Jul 29, 2017

Seeing same issue on iOS.
On startup, content in sidenav is locked. Navbar isn't.

I can click on the content, but it's not scrollable. Only when I click on the content (and on click) it jumps to their page, it becomes scrollable.

Is there a workaround?

I'll try the touchmove, but was wondering maybe there was a styling approach or an on init force this view so it works approach

@aleixsuau
Copy link

Hi, same issue here. Any clue @mmalerba ?
Thanks

@mmalerba
Copy link
Contributor

mmalerba commented Sep 1, 2017

I'm working on #6712 which will allow the sidenav to be put in fixed position mode, that way you can just let the body scroll naturally and not use overflow:auto and the fixed position sidenav will remain in place

@aleixsuau
Copy link

Hi @mmalerba ,
I've found that in my case the cause of the problem was bind to Hammer events:

<md-sidenav-container (swiperight)="openSideBar($event)" (swipeleft)="sidenav.close()">
  <md-sidenav #sidenav mode="over">
    <app-menu (click)="sidenav.close()"></app-menu>
  </md-sidenav>
  <div class="main-container">
    <router-outlet></router-outlet>
    <app-player></app-player>
  </div>
</md-sidenav-container>

If I remove swiperight and swipeleft events, scroll is not blocked anymore.

@mmalerba
Copy link
Contributor

sidenav now supports fixed position mode, documentation was added in #7775

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants