Skip to content

Commit 829a6a6

Browse files
committed
fix(pat inject): Second attempt to fix the scrolling behavior, where the scrolling target could not be found.
The original problem fixed in commit 911b8b8 for 9.9.0-beta.1 addressed a problem where the scroll target was not a direct child of the injected content but some levels deeper. But this fix broke the situation where the scroll target is a direct child of the injected content. The fix applied here handles both situations.
1 parent 167ef4c commit 829a6a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pat/inject/inject.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ const inject = {
492492
// 2) getting the element to scroll to (if not "top")
493493
const scroll_target = ["top", "target"].includes(cfg.scroll)
494494
? cfg.$target[0]
495-
: $(cfg.scroll, $injected)[0];
495+
: $injected.findInclusive(cfg.scroll)[0];
496496

497497
const scroll_container = dom.find_scroll_container(
498498
scroll_target,
@@ -502,7 +502,7 @@ const inject = {
502502

503503
if (cfg.scroll === "top") {
504504
dom.scroll_to_top(scroll_container);
505-
} else {
505+
} else if (scroll_target) {
506506
dom.scroll_to_element(scroll_target, scroll_container);
507507
}
508508
}

0 commit comments

Comments
 (0)