Chrome 61 body doesn't scroll

Does anyone know why assigning scrollTop on the body element no longer works?

eg: document.body.scrollTop = 200

causes the document not to scroll.

Cause: Chrome finally made scrolling spec conformant in version 61

Solution: Use scrollingElement

Update the example to:

var scrollNode = document.scrollingElement ? 
                 document.scrollingElement : document.body;
scrollNode.scrollTop = 200;

The solution described at the end of this question (checking for document.scrollingElement or falling back to document.body) won't work on IE, as it doesn't support document.scrollingElement (docs), and in IE, the scroll element is the HTML element.

I'd therefore suggest that a better solution for this would be something like;

var scrollNode = document.scrollingElement || document.documentElement;

Which should work for all modern browsers.


As a sidenote, it's interesting to consider that the scrollingElement property seems to have been added for the sole purpose of making it so that we don't need checks/fallbacks for getting the root scrolling element, but due to more browser incompatibilities, we still need a check/fallback in order to use scrollingElement.

Isn't web dev fun?