FIX: Regression in topic list kbd navigation (#15513)
This commit is contained in:
parent
71cf6839ab
commit
c908fa2f5b
|
@ -694,7 +694,8 @@ export default {
|
|||
selectedArticle: article,
|
||||
});
|
||||
|
||||
const articleTop = domUtils.offset(article).top;
|
||||
const articleTop = domUtils.offset(article).top,
|
||||
articleTopPosition = articleTop - headerOffset();
|
||||
if (!fast && direction < 0 && article.offsetHeight > window.innerHeight) {
|
||||
// Scrolling to the last "page" of the previous post if post has multiple
|
||||
// "pages" (if its height does not fit in the screen).
|
||||
|
@ -703,16 +704,22 @@ export default {
|
|||
);
|
||||
} else if (article.classList.contains("topic-post")) {
|
||||
return this._scrollTo(
|
||||
article.querySelector("#post_1") ? 0 : articleTop - headerOffset(),
|
||||
article.querySelector("#post_1") ? 0 : articleTopPosition,
|
||||
{ focusTabLoc: true }
|
||||
);
|
||||
}
|
||||
|
||||
// Otherwise scroll through the suggested topic list.
|
||||
article.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center",
|
||||
});
|
||||
// Otherwise scroll through the topic list.
|
||||
if (
|
||||
articleTopPosition > window.pageYOffset &&
|
||||
articleTop + article.offsetHeight <
|
||||
window.pageYOffset + window.innerHeight
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const scrollRatio = direction > 0 ? 0.2 : 0.7;
|
||||
this._scrollTo(articleTopPosition - window.innerHeight * scrollRatio);
|
||||
},
|
||||
|
||||
_scrollTo(scrollTop, opts = {}) {
|
||||
|
|
Loading…
Reference in New Issue