Material: select: opening menu causes body's scrollbar to disappear

Created on 29 Apr 2017  路  3Comments  路  Source: angular/material

We can see on the "official" CodePen : https://codepen.io/anon/pen/mmWGZj the parent scroll disappear when we click on the md-select. Actually, if we console.log the window.pageYOffset is set to 0 on top when md-select is selected because body style change.
I've got the same issue on a app and it make me crazy..

This effect seems to depends on parent containers, but can't reproduce exactly when. Maybe this issue is already knew ?

Additional Information:

  • Browser Type: last chrome
  • OS: ubuntu 16.04*

thanks

works as expected

Most helpful comment

I write this on my css and it's seems to fix the problem, but maybe some sides effects could be appear.

body {
  height: auto !important;
  position: absolute !important;
  top: 0 !important;
  width: 100% !important;
}

All 3 comments

I write this on my css and it's seems to fix the problem, but maybe some sides effects could be appear.

body {
  height: auto !important;
  position: absolute !important;
  top: 0 !important;
  width: 100% !important;
}

Just "height: auto !important;" needed on my body tag to fix it. Looks like the other options are not related at all. Thank you @zevenements

This issue has an acceptable workaround so I'm going to close it. By design, we don't want the body to scroll when a select's menu is open. Only the options in the menu should be scrolled.

Was this page helpful?
0 / 5 - 0 ratings