From d53ce1494676fb47504d7822f39efe474ffa080b Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 16 Mar 2016 11:18:28 +0000 Subject: 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. --- content_scripts/scroller.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content_scripts') 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. -- cgit v1.2.3