box / box-content-preview

JavaScript library for rendering files stored on Box
https://developer.box.com/docs/box-content-preview
Other
106 stars 113 forks source link

fix(a11y): screen reader support for view only file preview #1495

Closed arturfrombox closed 1 year ago

arturfrombox commented 1 year ago

This change adds support for screen readers and allow to disable copying content for view only PDF documents.

In order to simplify things the "view only" permission was implemented using CSS and JS , which should hopefully suffice. The advantage of this approach, as opposed to e.g. disabling the textLayer completely, is first of all that it ensures that document is accessible through a screen reader. Secondly this also ensures that searching still works correctly even in copy-protected documents.

This kind of copy-protection is not very strong and is also relatively easy to create some workarounds. Hence a simple solution, targeting "normal"-users rather than "advanced"-users is hopefully deemed acceptable here.

Demo - https://cloud.box.com/s/h9dg4g7bwxorp60qvfvqgu5trjx9v5q6

arturfrombox commented 1 year ago

@karelee7 @jstoffan thanks for reviewing, I updated this pr