Skip to content

Fix scroll-listener not removed on unmount #5

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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