aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-03-16 11:18:28 +0000
committerStephen Blott2016-03-16 11:18:34 +0000
commitd53ce1494676fb47504d7822f39efe474ffa080b (patch)
tree84f3f37d87eaac57b9c112575ef166f66d5d8fdf
parentaa35d7fe5eae257bc67e13f2f8d3f06442d428c7 (diff)
downloadvimium-d53ce1494676fb47504d7822f39efe474ffa080b.tar.bz2
Relocate first scrollable element.
When the scrollers `activatedElement` isn't scrollable, we currently search up the DOM tree for the next scrollable thing, and stop at `document.body`. However, it can be that that isn't scrollable. When that happens, this commit searches for a scrollable element in the same way as it does when the frame initially loads. This makes it possible to restart scrolling on pages like this one: - http://redux.js.org/docs/basics/UsageWithReact.html after clicking one of index links. Inspired by example posted by @marlun in #425.
-rw-r--r--content_scripts/scroller.coffee2
1 files changed, 1 insertions, 1 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 5f10ab65..58b0398d 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -82,7 +82,7 @@ findScrollableElement = (element, direction, amount, factor) ->
while element != document.body and
not (doesScroll(element, direction, amount, factor) and shouldScroll(element, direction))
element = (DomUtils.getContainingElement element) ? document.body
- element
+ if element == document.body then firstScrollableElement element else element
# On some pages, document.body is not scrollable. Here, we search the document for the largest visible
# element which does scroll vertically. This is used to initialize activatedElement. See #1358.