From a520ad4633b0d8f364d3a11cf628f3b414089b12 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 25 Mar 2024 10:04:47 +0100 Subject: [PATCH] Add alternative text to annotation if any --- src/display/annotation_layer.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index cfa4d840e..f8d2bec45 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -224,10 +224,14 @@ class AnnotationElement { // use of the z-index. container.style.zIndex = this.parent.zIndex++; - if (this.data.popupRef) { + if (data.popupRef) { container.setAttribute("aria-haspopup", "dialog"); } + if (data.alternativeText) { + container.title = data.alternativeText; + } + if (data.noRotate) { container.classList.add("norotate"); } @@ -1001,10 +1005,6 @@ class TextAnnotationElement extends AnnotationElement { class WidgetAnnotationElement extends AnnotationElement { render() { // Show only the container for unsupported field types. - if (this.data.alternativeText) { - this.container.title = this.data.alternativeText; - } - return this.container; } @@ -1736,10 +1736,6 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { const container = super.render(); container.classList.add("buttonWidgetAnnotation", "pushButton"); - if (this.data.alternativeText) { - container.title = this.data.alternativeText; - } - const linkElement = container.lastChild; if (this.enableScripting && this.hasJSActions && linkElement) { this._setDefaultPropertiesFromJS(linkElement);