FIX: full post jump not working (#25734)

Full post jump "SHIFT+K/J" not working if related topics are displayed

Amended logic so we unconditionally use full post jump on topic pages by
checking for .post-stream
This commit is contained in:
Sam 2024-02-19 09:16:46 +11:00 committed by GitHub
parent e4b6142d6a
commit 9372404a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -832,17 +832,18 @@ export default {
},
_changeSection(direction) {
const sections = Array.from(document.querySelectorAll(".nav.nav-pills li"));
const active = document.querySelector(".nav.nav-pills li.active");
const index = sections.indexOf(active) + direction;
if (index >= 0 && index < sections.length) {
sections[index].querySelector("a")?.click();
}
if (sections.length === 0) {
// use for in post navigation
if (document.querySelector(".post-stream")) {
this._moveSelection({ direction, scrollWithinPosts: false });
} else {
const sections = Array.from(
document.querySelectorAll(".nav.nav-pills li")
);
const active = document.querySelector(".nav.nav-pills li.active");
const index = sections.indexOf(active) + direction;
if (index >= 0 && index < sections.length) {
sections[index].querySelector("a, button")?.click();
}
}
},