Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

md-dialog backdrop displays incorrectly if page is scrolled #1967

Closed
dozingcat opened this issue Mar 19, 2015 · 13 comments
Closed

md-dialog backdrop displays incorrectly if page is scrolled #1967

dozingcat opened this issue Mar 19, 2015 · 13 comments
Assignees
Labels
for: internal contributor The team will address this issue and community PRs are not requested. type: bug
Milestone

Comments

@dozingcat
Copy link
Contributor

See http://codepen.io/anon/pen/ZYVpWo . Scroll down and click the button; the dialog backdrop will not cover the entire frame, and sometimes showing the dialog causes the page to unexpectedly jump.

@jelbourn jelbourn added type: bug for: internal contributor The team will address this issue and community PRs are not requested. labels Mar 20, 2015
@dominikstrasser
Copy link

maybe this could help you....
md-backdrop{
position: fixed;
}

@wesalvaro
Copy link
Contributor

The same is true for the bottom sheet.

I have a PR for the md-backdrop in #2023.

@david-gang
Copy link
Contributor

I think this is also connected to #1830
It happens also with sidenavs and scrolled content.

@ivanhtp
Copy link

ivanhtp commented May 22, 2015

Hey guys! This ticket is really important.

Just to complement: position fixed to backdrop won't solve the problem completely.
You must also change the class .md-dialog-is-showing on body ( overflow: hidden) to overflow: visible.

@alexthewilde
Copy link

+1

@wesalvaro
Copy link
Contributor

Quick fiddle to demonstrate this is still a very present bug:

http://output.jsbin.com/yotiloniri

Just make sure to shrink the screen vertically smaller than the content (the kitten picture).

@ThomasBurleson ThomasBurleson modified the milestones: 0.11.0, Backlog Jul 7, 2015
@ThomasBurleson ThomasBurleson self-assigned this Jul 7, 2015
@oli107
Copy link

oli107 commented Jul 17, 2015

+1

ThomasBurleson added a commit that referenced this issue Jul 21, 2015
improve backdrop animations and css to account for scroll and parenting:
backdrop
- css uses transition and ng-enter/ng-leav
- css transitions opacity instead of background-color
- css no longer uses key frames
- postLink uses $animate.pin if available
- postLink logs a warning if the backdrop parent has a style 'position:static'
util
- disableElementScroll uses specified element or body; used by dialog to disable dialog parent scrolling when parent is explicitly specified
dialog
- css for 'md-dialog-container' is now 'position:absolute'; 'fixed' is deprecated
- hide backdrop now runs in parallel with hide dialog
- basic demo #1 now uses element '#popupContainer' as parent; instead of document.body
- basic demo #1 has #popupContainer 'position:relative' styling

Fixes #3826, #3828, #1967, #1106
ThomasBurleson added a commit that referenced this issue Jul 21, 2015
improve backdrop animations and css to account for scroll and parenting:
-  backdrop
  - css uses transition and ng-enter/ng-leav
  - css transitions opacity instead of background-color
  - css no longer uses key frames
  - postLink uses $animate.pin if available
  - postLink logs a warning if the backdrop parent has a style 'position:static'
-  util
  - disableElementScroll uses specified element or body; used by dialog to disable dialog parent scrolling when parent is explicitly specified
  - refactor(util): centralize use of backdrop $compile
-  dialog
  - css for 'md-dialog-container' is now 'position:absolute'; 'fixed' is deprecated
  - hide backdrop now runs in parallel with hide dialog
  - basic demo #1 now uses element '#popupContainer' as parent; instead of document.body
  - basic demo #1 has #popupContainer 'position:relative' styling

Fixes #3826, #3828, #1967, #1106
@pablorsk
Copy link

pablorsk commented Aug 19, 2016

Solution

Search object causing the problem. For example a <md-sidenav /> tag with a parent like a <div>. On the code...

<div>
  <md-sidenav>
     <!-- this md-sidenav tag is causing a warning -->
  </md-sidenav>
</div>

Fixing the problem...

<div style="position:fixed;">
  <md-sidenav>
     <!-- No more warning! :) -->
  </md-sidenav>
</div>

#4813

@stephengardner
Copy link

the top offset of the <md-backdrop> element is not being properly calculated...
adding:

md-backdrop {
    top: 0;
}

might help you, if this is the case.

@gglukmann
Copy link

I managed to fix it with setting background from hex to rgba value with rgba(243, 246, 251, .99)

@tavurth
Copy link

tavurth commented Dec 19, 2016

Had the same problem, the body was getting custom styles added, a hacky fix:

/**
 * If we don't do this, angular material will break when loading modal windows
 * Don't remove this unless you have a better alternative
 */
body {
    top: 0 !important;
}

@ImaginationHub
Copy link

To solve the incorrect position after the scrolling in iPad Safari, please try:
.md-dialog-container{
position:fixed;
top:0 !important;
overflow:hidden;
}

@Kmasterrr
Copy link

Hi guys,

Only came across this now. But this is how you fix this error on mobi or web:
On your CSS the above mentioned by @ImaginationHub didnt work for me. So i had to the following:

.md-dialog-container {
    position: fixed;
    top: 0 !important;
    overflow: hidden;
}

.md-dialog-is-showing {
    position: fixed;
    top: 0 !important;
    overflow: hidden;
}

Hope this helps :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for: internal contributor The team will address this issue and community PRs are not requested. type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.