basing threshold on viewport size instead of element size
integrating mousetrap for keyboard control