Skip to content

Fix scroll-listener not removed on unmount #5

@holmberd

Description

@holmberd

this.addEventListener('scroll', this.#handleScroll.bind(this));
if (this.enableResizeObserver) {
this.#connectResizeObserver();
}
if (this.#initialized) {
this.#update();
}
}
disconnectedCallback() {
this.removeEventListener('scroll', this.#handleScroll);
this.#disconnectResizeObserver();
}

removeEventListener on LN275 is not using the bound handler reference at LN264.

Update to store a reference to the scroll event handler and use that to remove the handler on unmount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions