Include the /Lang-property, when it exists, in the StructTree-data (issue 14261)
*Please note:* This is a tentative patch, since I don't have the necessary a11y-software to actually test it.
This commit is contained in:
parent
712621b508
commit
971ac8e993
@ -295,6 +295,10 @@ class StructTreePage {
|
|||||||
if (isString(alt)) {
|
if (isString(alt)) {
|
||||||
obj.alt = stringToPDFString(alt);
|
obj.alt = stringToPDFString(alt);
|
||||||
}
|
}
|
||||||
|
const lang = node.dict.get("Lang");
|
||||||
|
if (isString(lang)) {
|
||||||
|
obj.lang = stringToPDFString(lang);
|
||||||
|
}
|
||||||
|
|
||||||
for (const kid of node.kids) {
|
for (const kid of node.kids) {
|
||||||
const kidElement =
|
const kidElement =
|
||||||
|
@ -1836,6 +1836,7 @@ sozialökonomische Gerechtigkeit.`)
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
role: "Document",
|
role: "Document",
|
||||||
|
lang: "en-US",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
role: "H1",
|
role: "H1",
|
||||||
|
@ -19,6 +19,7 @@ import { getDocument } from "../../src/display/api.js";
|
|||||||
function equalTrees(rootA, rootB) {
|
function equalTrees(rootA, rootB) {
|
||||||
function walk(a, b) {
|
function walk(a, b) {
|
||||||
expect(a.role).toEqual(b.role);
|
expect(a.role).toEqual(b.role);
|
||||||
|
expect(a.lang).toEqual(b.lang);
|
||||||
expect(a.type).toEqual(b.type);
|
expect(a.type).toEqual(b.type);
|
||||||
expect("children" in a).toEqual("children" in b);
|
expect("children" in a).toEqual("children" in b);
|
||||||
if (!a.children) {
|
if (!a.children) {
|
||||||
@ -47,6 +48,7 @@ describe("struct tree", function () {
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
role: "Document",
|
role: "Document",
|
||||||
|
lang: "en-US",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
role: "H1",
|
role: "H1",
|
||||||
|
@ -98,6 +98,9 @@ class StructTreeLayerBuilder {
|
|||||||
if (structElement.id !== undefined) {
|
if (structElement.id !== undefined) {
|
||||||
htmlElement.setAttribute("aria-owns", structElement.id);
|
htmlElement.setAttribute("aria-owns", structElement.id);
|
||||||
}
|
}
|
||||||
|
if (structElement.lang !== undefined) {
|
||||||
|
htmlElement.setAttribute("lang", structElement.lang);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_walk(node) {
|
_walk(node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user