fix: remove scrollHandler on unbind #17640
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Defect Fixes
Fixes a bug when using one menu for multiple targets in popup mode:
p-menu in popup mode does not close on scroll in some cases.
Szenario:
I have 40 icons. Clicking on any of them opens a menu in popup mode (only one instance of menu).
If I scroll now the menu closes ( fine! )
Then I delete the selected icon (entry in the menu).
And then I open the menu on an other icon ( show target changes).
When I scroll now the menu does not disappear.
The reason is that the scrollHandler still has the reference to the already deleted element.
This is bad for two reasons:
The solution is to remove the
scrollHandler
member ofMenu
on unbindScrollListener--> no more potential leaking of deleted elements
--> works now with differenet targets passed to show();