material icon indicating copy to clipboard operation
material copied to clipboard

scrolling when sideNav open

Open standuprey opened this issue 11 years ago • 14 comments

screen shot 2015-11-20 at 10 51 04 pm See in this copy of the angular material website sideNav codepen demo:

http://codepen.io/anon/pen/ZbZyZN

  • Open the right sideNav
  • Scroll down

Result: You see the backdrop and the right sidenav scrolling up Expected: nothing should scroll

Note: removing the height: 500px; on the body hides the issue

The workaround I have been using:

md-backdrop, md-sidenav {
position: fixed;
}

standuprey avatar Nov 21 '15 03:11 standuprey

Hey, This issue isn't happening to me. What Browser are you using?

devversion avatar Nov 21 '15 22:11 devversion

Tested on chrome, safari, ff. But you have to make the height of the window smaller if it does not occur (there must be an overflowing element to scroll to). material_preview

standuprey avatar Nov 23 '15 14:11 standuprey

@EladBezalel Should we completely disable scrolling for the whole document? Or is it by intention to disable scrolling only on the parent?

devversion avatar Nov 27 '15 17:11 devversion

@DevVersion is this related to #5887?

EladBezalel avatar Jan 14 '16 11:01 EladBezalel

@EladBezalel No I don't think so, my PR is just moving the sidenav down, if we are scrolled down on opening sidenav. So this seems to be another issue.

devversion avatar Jan 14 '16 13:01 devversion

@DevVersion for your question the scroll lock should listen to viewport changes and repaint itself. we don't want to force the scroll lock on the body.

EladBezalel avatar Jan 14 '16 13:01 EladBezalel

@EladBezalel - I'm sorry I talked about the other issue #5887. I meant only, that this issue isn't related to #5887.

devversion avatar Jan 14 '16 14:01 devversion

@DevVersion i've talked about your earlier comment :)

EladBezalel avatar Jan 14 '16 14:01 EladBezalel

@EladBezalel @standup75 This is not directly a bug and there should be not expectation to be not allowed to scroll. As the fixed height is applied to the second parent of the actual sidenav (parent > parent > sidenav), the sidenav will only disable scrolling for the first parent, so the second parent is able to scroll. That's the expected behaviour. So at this point, everything works as it should. Except that the backdrop should fill the complete parent, because the body isn't locked.

That's how the backdrop should actually look.

Preview

devversion avatar Feb 22 '16 17:02 devversion

@DevVersion @EladBezalel As best as I can see from https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-content, the content that is covered by a "darkened scrim" should not scroll; only the navigation drawer if it's contents are larger than the screen height.

@DevVersion Do you see something in the spec which suggests you can scroll a "darkened scrim"? Usually, the point of having the darker backdrop is to inform the user that you cannot interact with that portion of the page. In this sense, the temporary right sidenav is acting similarly to a dialog.

topherfangio avatar Feb 22 '16 20:02 topherfangio

@topherfangio Sorry I explained my thoughts a bit wrong.

  • I mean currently the sidenav will disable scrolling on the parent (disableParentScrolling)

And that works fine, but in this case / issue, there is the height of the second parent set to a fixed height.

parent(height="10000px";#first-parent)
   parent(#sidenavs-parent)
     md-backdrop(#from-the-sidenav)
     md-sidenav

So the normal parent (#sidenavs-parent) will be disabled for scrolling (that should work, as you can see in other demos) - but now we can still scroll the first parent (#first-parent), which is by intention (because we don't disable the whole body for scrolling) - So that issue is obviously not a bug.

So now I think in general the backdrop should fill its parent height

  • Currently the sidenavs backdrop is just filling the viewport with an absolute positon
  • But I suggest, that the backdrop should fill with its parent height

So the backdrops height should be set to its parents height, when the body isn't disabled for scrolling.

devversion avatar Feb 23 '16 14:02 devversion

Hi , I am new to Angular material. I am currently facing this scroll down issue. When i used position:fixed, it worked in laptops and but didnt worked in larger screens.

Can anyone suggest me a solution please? thanks Ela

selayamaran avatar Jun 05 '17 13:06 selayamaran

.mat-drawer {
    position: fixed !important;
} 

That's what I use in my app

ericel avatar Feb 20 '18 07:02 ericel

~~this is still an issue with 7.2.0~~

Edit: I was wrong. My issue was that it was scrolling down to <a> tags. If I place tabindex="-1" the issue goes away.

taivu avatar Jan 29 '19 18:01 taivu