From 461675cb7b6997954244a0132f728eac30053cc2 Mon Sep 17 00:00:00 2001 From: jelveh Date: Thu, 16 Jul 2026 18:43:53 -0700 Subject: [PATCH] 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. --- src/gui/src/UI/Dashboard/TabFiles.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/src/UI/Dashboard/TabFiles.js b/src/gui/src/UI/Dashboard/TabFiles.js index 2e009cdef..582c04155 100644 --- a/src/gui/src/UI/Dashboard/TabFiles.js +++ b/src/gui/src/UI/Dashboard/TabFiles.js @@ -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(); }