Skip to content

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

Closed

Description

@YeomansIII

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

Activity

  1. macjohnny commented on Jul 13, 2017

    @macjohnny
    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()

  2. maciejtreder commented on Jul 19, 2017

    @maciejtreder

    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>
    
  3. tiancovici commented on Jul 29, 2017

    @tiancovici

    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

  4. aleixsuau commented on Sep 1, 2017

    @aleixsuau

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

  5. mmalerba commented on Sep 1, 2017

    @mmalerba
    Contributor

    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

  6. aleixsuau commented on Sep 4, 2017

    @aleixsuau

    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.

  7. mmalerba commented on Nov 21, 2017

    @mmalerba
    Contributor

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

  8. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions