From 72011c5088e277b555212acb90b7b90818bb2f1f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 26 Apr 2026 14:33:47 +0200 Subject: [PATCH] Get the `zIndex` correctly in `PopupElement.prototype.renderCommentButton` In practice this probably hasn't caused any bugs, however given that `DOMElement.style.zIndex` returns a string the existing code is subtly wrong. This is also consistent with pre-existing `zIndex` code in the `PopupElement` class, see the `#show` and `#hide` methods. --- src/display/annotation_layer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 8206d3f7b..59cc9dfcb 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -2596,7 +2596,7 @@ class PopupElement { const button = (this.#commentButton = document.createElement("button")); button.className = "annotationCommentButton"; const parentContainer = this.#firstElement.container; - button.style.zIndex = parentContainer.style.zIndex + 1; + button.style.zIndex = parseInt(parentContainer.style.zIndex, 10) + 1; button.tabIndex = 0; button.ariaHasPopup = "dialog"; button.ariaControls = "commentPopup"; @@ -3778,6 +3778,8 @@ class AnnotationLayer { #hasAriaAttributesFromStructTree = false; + zIndex = 0; + constructor({ div, accessibilityManager, @@ -3798,7 +3800,6 @@ class AnnotationLayer { this.#annotationStorage = annotationStorage || new AnnotationStorage(); this.page = page; this.viewport = viewport; - this.zIndex = 0; this._annotationEditorUIManager = annotationEditorUIManager; this._commentManager = commentManager || null;