1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Add tagged annotations in the structure tree (bug 1850797)

This commit is contained in:
Calixte Denizet 2023-08-30 20:00:05 +02:00
parent 92f7653cfb
commit d185db2b70
10 changed files with 152 additions and 47 deletions

View file

@ -100,14 +100,15 @@ class StructTreeLayerBuilder {
}
#setAttributes(structElement, htmlElement) {
if (structElement.alt !== undefined) {
htmlElement.setAttribute("aria-label", structElement.alt);
const { alt, id, lang } = structElement;
if (alt !== undefined) {
htmlElement.setAttribute("aria-label", alt);
}
if (structElement.id !== undefined) {
htmlElement.setAttribute("aria-owns", structElement.id);
if (id !== undefined) {
htmlElement.setAttribute("aria-owns", id);
}
if (structElement.lang !== undefined) {
htmlElement.setAttribute("lang", structElement.lang);
if (lang !== undefined) {
htmlElement.setAttribute("lang", lang);
}
}