From c54c292873cc6ceaf606a6a0387040e97943e760 Mon Sep 17 00:00:00 2001 From: lokaesshwar Date: Wed, 26 Mar 2025 19:38:02 +0530 Subject: [PATCH] Fix #2682: Ensure unique ID for overlay wrapper to prevent duplicate IDs --- src/overlay.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/overlay.js b/src/overlay.js index 36ea93a1..447e9c67 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -133,12 +133,9 @@ this.elementWrapper.appendChild(this.element); if (this.element.id) { - this.elementWrapper.id = "overlay-wrapper-" + this.element.id; - } else { - this.elementWrapper.id = "overlay-wrapper-" + crypto.randomUUID(); // Ensure unique ID + this.elementWrapper.id = "overlay-wrapper-" + this.element.id; // Unique ID if element has one } - - // Always add a class for easier selection + // Always add a class for styling & selection this.elementWrapper.classList.add("openseadragon-overlay-wrapper"); @@ -502,4 +499,4 @@ } }; -}(OpenSeadragon)); +}(OpenSeadragon)); \ No newline at end of file