PolymerElements / iron-fit-behavior

Fits an element into another element
17 stars 34 forks source link

'constrain' error when element's parent has an offset #13

Closed imskull closed 8 years ago

imskull commented 9 years ago
<body>
  <div id='main' style='width=100, height=100%'>
    ...
  </div>
  <div id='modals-container'>
    <paper-dialog>
      ...
    </paper-dialog>
  </div>

In this case, the top of paper-dialog is not zero, it causes _sizeDimension may set max-height to zero or a negative value. The negative max-height may discard by css, so you may not notice the issue in some cases, but when it happens to be zero, the dialog is not visible.

imskull commented 9 years ago

BTW, I wanted to create a fiddle but could not find a CDN for polymer 1.0 :(

ahumblenerd commented 9 years ago

https://gist.github.com/sjmiles/f14ec792b9766fbb04ff .Take a look into that . Its a gist for the CDN. https://rawgit.com/ or look into this.

barakhub commented 9 years ago

Shameless plug...

@imskull you can try a simple AppEngine tool I created to play with Polymer 1.0. Here's an example that demonstrates something similar to the issues you're facing: http://poly-play.appspot.com/BVluc_YX514

vorporeal commented 9 years ago

I'm also running into this bug. In our case, the main page content exactly fits the viewport (using "height: 100vh") and the overlay element sits (invisibly) in a container directly below the page content. In this situation, upon opening the dialog, the "offset" variable in _sizeDimension() is equal to the max viewport height, and so the overlay element is given a max-height of 0.

Here's a tiny page I threw together which highlights the issue: https://rawgit.com/vorporeal/2ed775ef27a6931aab64/raw/af3dfb74ff92835a8ba6d72424eb03e89f44e948/iron-fit-constrain-bug.html (you'll need to use escape to close the dialog, not sure why clicking on the backdrop isn't working)

I'd contribute a fix, but I'm not convinced I could put one together that doesn't introduce other bugs.

notwaldorf commented 8 years ago

Looks like it's been fixed in #22