The library inserts an invisible faux modal, computes its top position using above, removes the faux modal, and then inserts the real modal which applies the top position computed earlier.
However, an absolute-positioned element with % "top" property that is hidden through display: none; does not evaluate the JS to the same value as when it is visible. The computed "top" value for the hidden element is still the % value, while it is the computed px value if the element is visible or when using visibility: hidden. This is demonstrated in this Plunker.
$modalStack.openexpects the expression above to return the px value, so a 10% value gets treated as 10px. This is not the desired behavior, and a big limitation now that people use a big range of screen sizes.
The faux modal is temporarily inserted with z-index: -1 (JS), display: none (CSS), and visibility: hidden (CSS).
As a workaround, this commit applies display: block (JS) to the faux modal.
Release notes
Fix vertical position of modal when ".reveal-modal" has % "top" property
Fix vertical position of modal when
.reveal-modal
has % "top" property(I also submitted https://github.com/cwadrupldijjit/angular-foundation/pull/1.)
Description
Currently, if the "reveal-modal" CSS class is assigned an n% "top" CSS property, the modal would be positioned n px from the top of the viewport.
The modal uses the following JS:
The library inserts an invisible faux modal, computes its top position using above, removes the faux modal, and then inserts the real modal which applies the top position computed earlier.
However, an absolute-positioned element with % "top" property that is hidden through
display: none;
does not evaluate the JS to the same value as when it is visible. The computed "top" value for the hidden element is still the % value, while it is the computed px value if the element is visible or when usingvisibility: hidden
. This is demonstrated in this Plunker.$modalStack.open
expects the expression above to return the px value, so a10%
value gets treated as10px
. This is not the desired behavior, and a big limitation now that people use a big range of screen sizes.The faux modal is temporarily inserted with
z-index: -1
(JS),display: none
(CSS), andvisibility: hidden
(CSS).As a workaround, this commit applies
display: block
(JS) to the faux modal.Release notes
Changelog Category: Bug Fixes