From 65c8549759de630ae3c1cf687035a973f45e7afc Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Mon, 14 May 2018 23:10:32 -0400 Subject: [PATCH] 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. --- web/ui_utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/ui_utils.js b/web/ui_utils.js index 2ecdcb0ed..f59acab2b 100644 --- a/web/ui_utils.js +++ b/web/ui_utils.js @@ -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) {