mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
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.