Move onscroll detection

#2175 with the test moved & updated.