Fix bug in scrollIntoView

Prior to this commit, if the vertical scroll bar is absent and the horizontal
scroll bar is present, a link to a particular point on the page which should
induce a horizontal scroll did not do so, because the absence of a vertical
scroll bar meant that the viewer was not recognized as the nearest scrolling
ancestor. This commit adds a check for horizontal scroll bars when searching
for the scrolling ancestor.
This commit is contained in:
Ryan Hendrickson 2018-05-14 23:10:32 -04:00
parent c5c06bf5c4
commit 65c8549759

View File

@ -115,7 +115,8 @@ function scrollIntoView(element, spot, skipOverflowHiddenElements = false) {
}
let offsetY = element.offsetTop + element.clientTop;
let offsetX = element.offsetLeft + element.clientLeft;
while (parent.clientHeight === parent.scrollHeight ||
while ((parent.clientHeight === parent.scrollHeight &&
parent.clientWidth === parent.scrollWidth) ||
(skipOverflowHiddenElements &&
getComputedStyle(parent).overflow === 'hidden')) {
if (parent.dataset._scaleY) {