fix: call handleScrollFocus before binding scroll event handlers
Call handleScrollFocus before adding scroll event listeners to prevent handleScrollSave from triggering during initial setup.
This commit is contained in:
parent
14ebbda585
commit
eca0cf4193
@ -159,13 +159,13 @@ function initScrollFocus() {
|
|||||||
|
|
||||||
scrollView.removeEventListener("scroll", handleScrollFocus);
|
scrollView.removeEventListener("scroll", handleScrollFocus);
|
||||||
scrollView.removeEventListener("scroll", handleScrollSave);
|
scrollView.removeEventListener("scroll", handleScrollSave);
|
||||||
|
|
||||||
|
// Initial call to set in-focus class (before binding scroll handler)
|
||||||
|
handleScrollFocus();
|
||||||
|
|
||||||
|
// Bind scroll handlers after initial setup
|
||||||
scrollView.addEventListener("scroll", handleScrollFocus);
|
scrollView.addEventListener("scroll", handleScrollFocus);
|
||||||
scrollView.addEventListener("scroll", handleScrollSave);
|
scrollView.addEventListener("scroll", handleScrollSave);
|
||||||
|
|
||||||
// Initial call to set in-focus class (skip saving during init)
|
|
||||||
isInitializing = true;
|
|
||||||
handleScrollFocus();
|
|
||||||
isInitializing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleScrollFocus() {
|
function handleScrollFocus() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user