Skip to content

[Bug] Palette outside-click listener not cleaned up on close #5362

@severe77

Description

@severe77

Description

When opening and closing a palette multiple times, the palette menu attaches a
document.click outside-click listener repeatedly. The listener lifecycle was
not fully cleaned up, leading to accumulated event listeners and memory growth
during long sessions.

Expected Behavior

  • Only one outside-click listener should be attached while a palette is open
  • The listener should be removed immediately when the palette closes
  • No listeners should persist between palette open/close cycles

How to Reproduce

  1. Open any palette from the palette selector
  2. Close the palette
  3. Repeat opening and closing the palette multiple times
  4. Inspect document click listeners in browser dev tools
  5. Observe listener count increasing over time

Console log Errors:

No console errors are thrown, but performance degrades due to accumulated
event listeners.

Environment:

  • Operating System: Windows
  • Browser (if applicable): Chrome
  • Version of Software/Project: Music Blocks (current master)

Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.

Thank you for contributing to our project! We appreciate your help in improving it.

📚 See contributing instructions.

🙋🏾🙋🏼 Questions: Community Matrix Server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions