Prevent modal from triggering while scrolling

Solves issue #598