dialog: cuts off/hides body when window is scrolled
Fiddle: http://jsfiddle.net/rgthree/9m7z8cqy/
If body has any overflow applied by the app, angular overrides its style to hidden when the dialog is open. This clashes with the other styles added to body, particularly, position: fixed; top: -XXpx; and max-height: 100% from the md-dialog-is-showing class which ends up cutting off the body content or completely hiding it when the window has scrolled more than 100% the height.
Note, we use body {overflow-x:scroll;} to force a scrollbar and reduce horizontal jitter when page content height changes due to navigation.
Has anyone been able to solve this. I am having the same issue
@zilions were u able to find a fix for this issue?
not sure if this is a true fix, but this seemed to do the trick for me:
body { overflow-x: visible; }
@lexyfeito - No fix from me yet. Tried everything in this thread and nothing seems to work well.
@zilions same here this is getting really annoying
@zilions hey so after reading @abouillon comment i set the body overflow: initial; and it seems to fixed the problem.
@lexyfeito That's what I was going to suggest, but I was also trying to see if there was a workaround if someone was using the parent option and setting the parent container of the dialog to something other than the document body. So far I haven't found a quick workaround if a user sets the parent to something other than body. Luckily, in my use case, we just let material set the parent container to the document body, but it would be nice if there was a workaround for those who need the parent to be something else.
I managed to solve my issue today, after hours of digging into code and work arounds. Thought I'd share for anyone else that is struggling with the same problem.
.md-dialog-container { height: 100vh !important; top: 0 !important; position: fixed !important; }
@zilions did setting body overflow to initial didnt do the work for you? This seems like a lot of more work
@lexyfeito - It did not work in my case unfortunately. Most of my content is absolute positions, so it's probably a different layout to most other sites. The code I posted above is the only way I could get it to work for me.
@zilions oh well i am glad you found a fix/workaround at least :)
@akashjarad, @abouillon, @zilions: FWIW, you can isolate the workaround by using .md-dialog-is-showing which is appended to the body when a dialog is showing. This seems to fix it for me while still allowing me to use overflow-y: scroll when a dialog is not shown.
body.md-dialog-is-showing {
overflow: visible !important;
}
You should keep in mind that this and the other fixes mentioned, while fixes our problems right now, could introduce issues going forward. Clearly, Angular is expecting body to be overflow hidden.
@rgthree you are right and it does work it my case thank you so much for your suggestion.
@rgthree hey man this fixed/workaround doesn't seem to work on IE. Does it happen to you to?
I'm having this bug too. Thank you @rgthree for the fix.
@rgthree Sir, you are such a big help! Thanks for the fix!! I have been digging the internet for hours to get this fix.
Just ran into this bug with codes on master branch. It's really wired.
thanks @rgthree fixed my issue !
This was closed but still seems to be an issue on master. Using the suggestions above @rgthree & @zilions helped fix it for me. I'd just like to know if there is going to be an official solution for this? Thanks.
@rgthree Your solution helped me so much! Can't thank you enough!