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:
parent
c5c06bf5c4
commit
65c8549759
@ -115,7 +115,8 @@ function scrollIntoView(element, spot, skipOverflowHiddenElements = false) {
|
|||||||
}
|
}
|
||||||
let offsetY = element.offsetTop + element.clientTop;
|
let offsetY = element.offsetTop + element.clientTop;
|
||||||
let offsetX = element.offsetLeft + element.clientLeft;
|
let offsetX = element.offsetLeft + element.clientLeft;
|
||||||
while (parent.clientHeight === parent.scrollHeight ||
|
while ((parent.clientHeight === parent.scrollHeight &&
|
||||||
|
parent.clientWidth === parent.scrollWidth) ||
|
||||||
(skipOverflowHiddenElements &&
|
(skipOverflowHiddenElements &&
|
||||||
getComputedStyle(parent).overflow === 'hidden')) {
|
getComputedStyle(parent).overflow === 'hidden')) {
|
||||||
if (parent.dataset._scaleY) {
|
if (parent.dataset._scaleY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user