mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-28 17:07:16 +00:00
Avoid stacking image-preview document click handlers
showImagePreview bound a click.imagepreview handler without removing a prior one. It is re-invoked during image arrow-navigation while a preview is open, so identical document handlers accumulated until close. Remove any existing handler before binding.
This commit is contained in:
@@ -974,9 +974,10 @@ const TabFiles = {
|
||||
this.previewOpen = true;
|
||||
this.previewCurrentUid = uid;
|
||||
|
||||
// Close on click outside the popover
|
||||
// Close on click outside the popover. Remove any prior handler first so
|
||||
// repeated calls (image arrow-navigation) don't stack duplicate handlers.
|
||||
const _this = this;
|
||||
$(document).on('click.imagepreview', (e) => {
|
||||
$(document).off('click.imagepreview').on('click.imagepreview', (e) => {
|
||||
if ( ! $(e.target).closest('.image-preview-popover').length ) {
|
||||
_this.closeImagePreview();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user