-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix vertical position of modal when ".reveal-modal" has % "top" property #319
Open
kristinalim
wants to merge
2
commits into
yalabot:master
Choose a base branch
from
openfoodfoundation:fix-modal-wrong_position_when_percent_top_property
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix vertical position of modal when ".reveal-modal" has % "top" property #319
kristinalim
wants to merge
2
commits into
yalabot:master
from
openfoodfoundation:fix-modal-wrong_position_when_percent_top_property
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kristinalim
force-pushed
the
fix-modal-wrong_position_when_percent_top_property
branch
from
August 15, 2018 08:14
113e444
to
ee2d666
Compare
kristinalim
force-pushed
the
fix-modal-wrong_position_when_percent_top_property
branch
from
August 15, 2018 09:21
ee2d666
to
93d3d87
Compare
kristinalim
added a commit
to kristinalim/openfoodnetwork
that referenced
this pull request
Aug 15, 2018
There is a bug in the handling of % values for the "top" CSS property of the modals. See details here: openfoodfoundation/angular-foundation#1 A PR to the original repository has also been submitted, but the project doesn't seem to be active anymore: yalabot/angular-foundation#319 The bug was causing the 10% "top" CSS property for the modal to be treated as 10px.
kristinalim
force-pushed
the
fix-modal-wrong_position_when_percent_top_property
branch
2 times, most recently
from
August 26, 2018 05:49
5a7396f
to
f30436e
Compare
An absolute-positioned element with % "top" property that is hidden through "display: none;" does not evaluate to the same value as a visible one for the following JS: window.getComputedStyle(element).top 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 the following Plunker: http://run.plnkr.co/preview/cjkut64np00072y6ccj3tmqem/ $modalStack.open expects 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 assigns "display: block" (JS) to the faux modal.
I updated the PR description to be clearer. |
kristinalim
added a commit
to kristinalim/openfoodnetwork
that referenced
this pull request
Aug 26, 2018
There is a bug in the handling of % values for the "top" CSS property of the modals. See details here: openfoodfoundation/angular-foundation#1 A PR to the original repository has also been submitted, but the project doesn't seem to be active anymore: yalabot/angular-foundation#319 The bug was causing the 10% "top" CSS property for the modal to be treated as 10px.
kristinalim
added a commit
to kristinalim/openfoodnetwork
that referenced
this pull request
Aug 26, 2018
There is a bug in the handling of % values for the "top" CSS property of the modals. See details here: openfoodfoundation/angular-foundation#1 A PR to the original repository has also been submitted, but the project doesn't seem to be active anymore: yalabot/angular-foundation#319 And to another fork of the repository: cwadrupldijjit/angular-foundation#1 The bug was causing the 10% "top" CSS property for the modal to be treated as 10px.
kristinalim
added a commit
to kristinalim/openfoodnetwork
that referenced
this pull request
Sep 3, 2018
There is a bug in the handling of % values for the "top" CSS property of the modals. See details here: openfoodfoundation/angular-foundation#1 A PR to the original repository has also been submitted, but the project doesn't seem to be active anymore: yalabot/angular-foundation#319 And to another fork of the repository: cwadrupldijjit/angular-foundation#1 The bug was causing the 10% "top" CSS property for the modal to be treated as 10px.
kristinalim
added a commit
to kristinalim/openfoodnetwork
that referenced
this pull request
Sep 5, 2018
There is a bug in the handling of % values for the "top" CSS property of the modals. See details here: openfoodfoundation/angular-foundation#1 A PR to the original repository has also been submitted, but the project doesn't seem to be active anymore: yalabot/angular-foundation#319 And to another fork of the repository: cwadrupldijjit/angular-foundation#1 The bug was causing the 10% "top" CSS property for the modal to be treated as 10px.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix vertical position of modal when
.reveal-modal
has % "top" property(I also submitted cwadrupldijjit#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