Merge pull request #17835 from calixteman/annotation_alt_text

Add alternative text to annotation if any
This commit is contained in:
calixteman 2024-03-25 16:40:06 +01:00 committed by GitHub
commit ad791cc462
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -224,10 +224,14 @@ class AnnotationElement {
// use of the z-index. // use of the z-index.
container.style.zIndex = this.parent.zIndex++; container.style.zIndex = this.parent.zIndex++;
if (this.data.popupRef) { if (data.popupRef) {
container.setAttribute("aria-haspopup", "dialog"); container.setAttribute("aria-haspopup", "dialog");
} }
if (data.alternativeText) {
container.title = data.alternativeText;
}
if (data.noRotate) { if (data.noRotate) {
container.classList.add("norotate"); container.classList.add("norotate");
} }
@ -1001,10 +1005,6 @@ class TextAnnotationElement extends AnnotationElement {
class WidgetAnnotationElement extends AnnotationElement { class WidgetAnnotationElement extends AnnotationElement {
render() { render() {
// Show only the container for unsupported field types. // Show only the container for unsupported field types.
if (this.data.alternativeText) {
this.container.title = this.data.alternativeText;
}
return this.container; return this.container;
} }
@ -1736,10 +1736,6 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
const container = super.render(); const container = super.render();
container.classList.add("buttonWidgetAnnotation", "pushButton"); container.classList.add("buttonWidgetAnnotation", "pushButton");
if (this.data.alternativeText) {
container.title = this.data.alternativeText;
}
const linkElement = container.lastChild; const linkElement = container.lastChild;
if (this.enableScripting && this.hasJSActions && linkElement) { if (this.enableScripting && this.hasJSActions && linkElement) {
this._setDefaultPropertiesFromJS(linkElement); this._setDefaultPropertiesFromJS(linkElement);