From 90d2addc9b8f95f9272f8c2a77bdaf9dfebc0fa8 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 31 Jan 2015 08:02:46 +0000 Subject: Fix scrolling issue. On this page: - http://www.steephill.tv/dubai-tour/ I was seeing a scrolling problem in my live browser (j/k didn't work until I clicked on the page), but couldn't reproduce it directly in my test browser. That's worrying. Nevertheless, what was happening was that we succeeded in scrolling a test amount in one direction, but the scroll to revert failed. The consequence was that we concluded (incorrectly) that the element doesn't scroll. And j/k scrolling is broken as a result. How can it be that a scroll in one direction succeeds, but the reverse does not? This fixes the problem by not checking whether we are able to undo the scroll of our test amount. --- content_scripts/scroller.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'content_scripts') diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee index 6e2e1ffc..b9e7d76a 100644 --- a/content_scripts/scroller.coffee +++ b/content_scripts/scroller.coffee @@ -75,7 +75,11 @@ doesScroll = (element, direction, amount, factor) -> # definitely scrolling backwards, so a delta of -1 will do. For absolute scrolls, factor is always 1. delta = factor * getDimension(element, direction, amount) || -1 delta = getSign delta # 1 or -1 - performScroll(element, direction, delta) and performScroll(element, direction, -delta) + for change in [ delta, -delta ] + if performScroll element, direction, change + performScroll element, direction, -change + return true + false # From element and its parents, find the first which we should scroll and which does scroll. findScrollableElement = (element, direction, amount, factor) -> -- cgit v1.2.3