Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

arturfrombox
Copy link
Contributor

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 arturfrombox requested a review from a team as a code owner August 1, 2023 14:07
karelee7
karelee7 previously approved these changes Aug 1, 2023
Copy link
Contributor

@karelee7 karelee7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

src/lib/viewers/doc/DocBaseViewer.js Outdated Show resolved Hide resolved
src/lib/viewers/doc/DocBaseViewer.js Outdated Show resolved Hide resolved
src/lib/viewers/doc/_docBase.scss Outdated Show resolved Hide resolved
src/lib/viewers/doc/_docBase.scss Show resolved Hide resolved
src/lib/viewers/doc/DocBaseViewer.js Show resolved Hide resolved
@arturfrombox
Copy link
Contributor Author

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

jstoffan
jstoffan previously approved these changes Aug 2, 2023
@@ -304,6 +304,17 @@ $thumbnail-sidebar-width: 191px; // Extra pixel to account for sidebar border
}
}

.pdfViewer {
&--viewOnly {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically want to spell out class names so they're easy to search for using our IDEs:

&.pdfViewer--viewOnly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure
i just updated the pr

@arturfrombox arturfrombox force-pushed the fix-a11y-view-only-permissions branch from 7e2e7e1 to d5082ec Compare August 3, 2023 08:41
@arturfrombox arturfrombox merged commit 9a0b4ab into box:master Aug 3, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants