aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2017-11-18 12:15:43 +0000
committerGitHub2017-11-18 12:15:43 +0000
commitd6aa3547931fa3b27392cfb20ce49cee557d77dd (patch)
tree479f5aacc4e2ef153a0239d79dec7df621b841d4 /content_scripts
parent8724b70d49a57070ce3064c71b12c3905b467f9d (diff)
parentde0c06e180690a0101b4dda92e3164fa198485fd (diff)
downloadvimium-d6aa3547931fa3b27392cfb20ce49cee557d77dd.tar.bz2
Merge pull request #2801 from mrmr1993/pr/search-for-scrolling-element-from-body
Start searching for scrollable elements from <body> instead of <html> whenever possible
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/scroller.coffee9
1 files changed, 8 insertions, 1 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 4a6c7edf..e2e05722 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -95,7 +95,14 @@ findScrollableElement = (element, direction, amount, factor) ->
# On some pages, the scrolling element is not actually scrollable. Here, we search the document for the
# largest visible element which does scroll vertically. This is used to initialize activatedElement. See
# #1358.
-firstScrollableElement = (element=getScrollingElement()) ->
+firstScrollableElement = (element) ->
+ unless element
+ scrollingElement = getScrollingElement()
+ if doesScroll(scrollingElement, "y", 1, 1) or doesScroll(scrollingElement, "y", -1, 1)
+ return scrollingElement
+ else
+ element = document.body ? getScrollingElement()
+
if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1)
element
else