From 9901949c71fa3c2ac226f1ad23d4757bab05248b Mon Sep 17 00:00:00 2001 From: rohitgs28 Date: Fri, 14 Mar 2025 00:02:09 -0400 Subject: [PATCH] Fix duplicate overlay wrapper IDs: assign id only if element has an id and add overlay wrapper class --- src/overlay.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/overlay.js b/src/overlay.js index 61f5fa88..a0712096 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -132,11 +132,17 @@ this.element = options.element; this.elementWrapper.appendChild(this.element); + // Create the overlay wrapper + this.elementWrapper = document.createElement('div'); + this.elementWrapper.appendChild(this.element); + + // Assign a unique ID only if the overlay element has an id if (this.element.id) { this.elementWrapper.id = "overlay-wrapper-" + this.element.id; - } else { - this.elementWrapper.id = "overlay-wrapper"; } + // Always add a class for styling and selection purposes + this.elementWrapper.className = "openseadragon-overlay-wrapper"; + this.style = this.elementWrapper.style; this._init(options);