intbot / ng2-pdfjs-viewer

An angular component for PDFJS and ViewerJS (Supports all versions of angular)
Apache License 2.0
228 stars 112 forks source link

Accessibility: title attribute for the iframe is not meaningful #127

Open justinribeiro opened 3 years ago

justinribeiro commented 3 years ago

Currently, the iframe title attribute is hard set within the template to ng2-pdfjs-viewer:

https://github.com/intbot/ng2-pdfjs-viewer/blob/5f93415482fa0d3aae34205c7c0e970405010e26/dist/index.js#L357

For screen readers users, they're not able to understand what type of content to expect within an iframe (2.4 NavigableTitles on Frames (2.4.1.b). It would be useful to be able to set the title on the component attr and have it reflect appropriately to the iframe.

The short term workaround is to simply target the iframe and hot wire the title:

document.querySelector("ng2-pdfjs-viewer > iframe").title = "My Special Document";

If there is a arch direction you'd like to provide, happy to make a PR.

codehippie1 commented 3 years ago

@justinribeiro My experience with accessibility adherence is quite limited. Please send me a PR if you have time, I will gladly merge(This library is extremely simple at 300 lines of code)