Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event listeners not removed for ReorderableRow and ReorderableColumn #11414

Closed
woppa684 opened this issue Apr 13, 2022 · 0 comments · Fixed by #11597
Closed

Event listeners not removed for ReorderableRow and ReorderableColumn #11414

woppa684 opened this issue Apr 13, 2022 · 0 comments · Fixed by #11597
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@woppa684
Copy link

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Copied from #11357 (which was partly solved and then closed)

The main problem is in the implementation of both the unbind methods for ReorderableRow and ReorderableColumn. To illustrate this, a small excerpt from one of the bind functions:

this.mouseDownListener = this.onMouseDown.bind(this);
this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener);

And the corresponding unbind:

if (this.mouseDownListener) {
document.removeEventListener('mousedown', this.mouseDownListener);
this.mouseDownListener = null;
}

As can be seen, the listeners are registered on the nativeElement but removed from the document (where the listener was never registered), leaving the event listeners on the nativeElement behind. One could argue that, as the element is removed also the listeners get cleaned up, but this does not work for every usecase. Also, it seems that the idea was to have unbind methods, so let's make sure that they're correct :)

volvachev added a commit to volvachev/primeng that referenced this issue May 25, 2022
volvachev added a commit to volvachev/primeng that referenced this issue Jun 7, 2022
@cetincakiroglu cetincakiroglu added this to the 13.4.2 milestone Jun 7, 2022
@cetincakiroglu cetincakiroglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
2 participants