[Bug]: MultiSelect dropdown scroll listener not removed when component destroyed while open
Author: zoujunhui1Created Sep 14, 2026Updated Sep 14, 2026
Labelsbug
What happened?
When a MultiSelect / MultiSelectDropdown / MultiSelectQueryInput dropdown is open and its parent component gets destroyed (e.g. closing an edit modal via the X button without first clicking elsewhere to blur the input), the document-level scroll event listener added by setListener() is never removed. beforeDestroy() only removes the menu DOM element but never calls removeListener().
What did you expect to happen?
The scroll listener should be cleaned up whenever the component is destroyed, regardless of whether the dropdown was open or closed at that moment.
Steps to reproduce the issue
- Open any book's edit modal → Details tab.
- Click the Genres input to open its dropdown (this calls setListener())
- Immediately close the edit modal via the X button, without clicking elsewhere first
- beforeDestroy() fires while showMenu is still true, and removeListener() is never called — confirmed via console logging that document.removeEventListener('scroll', ...) is not invoked for this instance
Audiobookshelf version
v2.36.0
How are you running audiobookshelf?
Built from source
What OS is your Audiobookshelf server hosted from?
macOS
If the issue is being seen in the UI, what browsers are you seeing the problem on?
None
Logs
Additional Notes
No response
Source: advplyr/audiobookshelf