       CoreScroller.scroll element, direction, elementAmount, continuous
 
   scrollTo: (direction, pos) ->
-    activatedElement ||= (document.body and firstScrollableElement()) or document.body
+    activatedElement ||= (document.documentElement and firstScrollableElement()) or document.documentElement
     return unless activatedElement
 
     element = findScrollableElement activatedElement, direction, pos, 1


# From element and its parents, find the first which we should scroll and which does scroll.
findScrollableElement = (element, direction, amount, factor) ->
  while element != document.body and
    not (doesScroll(element, direction, amount, factor) and shouldScroll(element, direction))
      element = element.parentElement || document.body
  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.
firstScrollableElement = (element=document.body) ->
  if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1)
    element
  else

  # Scroll the top, bottom, left and right of element into view.  The is used by visual mode to ensure the
  # focus remains visible.
  scrollIntoView: (element) ->
    activatedElement ||= document.documentElement and firstScrollableElement()
    rect = element. getClientRects()?[0]
    if rect?
      # Scroll y axis.
