Skip to content

Commit

Permalink
Lower the start point for sliding of modals
Browse files Browse the repository at this point in the history
Occasionally, the page scrolls up while the modal is being opened. This
was causing the final position of the modal to be at the wrong location
relative to the viewport.

This was happening because of a race condition between the animation
that slides the modal from above the viewport to the middle, and focus()
which the modal does:

https://github.com/yalabot/angular-foundation/blob/0.8.0/src/modal/modal.js#L109

The final vertical position of the modal is at 10%, so the animation
which translates the modal -25% vertically was starting -15% above the
viewport. The focus() was then causing vertical scroll.

This lowers the starting point of the animation, so there will no longer
be scrolling.

Additionally, the animation would only happen on large screens. The CSS
property "top" is 0 for smaller screens.
  • Loading branch information
kristinalim committed Sep 3, 2018
1 parent d27be6f commit 4bcafcd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/assets/stylesheets/darkswarm/animations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@
-moz-transition: -moz-transform 0.2s ease-out;
-o-transition: -o-transform 0.2s ease-out;
transition: transform 0.2s ease-out;
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
transform: translate(0, -25%);

@media only screen and (min-width: 641px) {
-webkit-transform: translate(0, -10%);
-ms-transform: translate(0, -10%);
transform: translate(0, -10%);
}
}

.reveal-modal.in {
Expand Down

0 comments on commit 4bcafcd

Please sign in to comment.