foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser
http://pdfkit.org/
MIT License
9.8k stars 1.14k forks source link

Accessibility: Why should I tag a group of items ? #1312

Open Foohx opened 2 years ago

Foohx commented 2 years ago

Question

Description

Hello, I hope someone can guide me on this question regarding PDF tagging. What is the point of using Sect, Div or Art knowing that screen readers seem to ignore completely this data.

I have trouble identifying use cases..

Thanks

Code sample

N/A

Your environment

brennanyoung commented 1 year ago

The whole point of recent accessibility legislation is to resolve the "chicken-and-egg" problem by making sure public-facing digital documents include appropriate semantics, even if the user-agents/readers don't yet support all the features.

Some web browsers today (such as Firefox) convert PDF tags into semantic HTML. If you've used Sect, it will become a <section>, and screen readers will not ignore that.

I have noticed some improvements in screen reader support for PDF semantics in the last couple of years (since your post). There are still a lot of gaps, but I can only imagine that they will be filled. PDF accessibility has only been mandatory for a few years and (frankly) the tools available for making accessible PDF in that time mostly suck.

More pragmatically, I would advise worrying less about Sect, Div and Art, and instead prioritizing the tagging of headings and lists, text alternatives for images, tag order and read order. These features all have some support from the leading screen readers today, although some of that support is still very new.

I don't imagine that the screen reader vendors will stop there. The legal imperatives will make it necessary sooner or later.

The link below is (to my knowledge) the only fornal attempt to document screen reader support for PDF features. I hope it will be kept updated, and even expanded to cover features such as Sect, Div and Art. https://www.powermapper.com/tests/screen-readers/pdf/