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

VPAT: aria edits #127

Merged
merged 1 commit into from
Jun 14, 2024
Merged

VPAT: aria edits #127

merged 1 commit into from
Jun 14, 2024

Conversation

abaevbog
Copy link
Contributor

@abaevbog abaevbog commented Jun 11, 2024

Address zotero/zotero#4220 and easier parts of zotero/zotero#4222

  • vpat 60: added role=button and aria-label to X clear icon of search annotations so it's clear what that button does
  • vpat 61: hide magnifying glass of search annotations field from screen readers, since it should never be focusable
  • vpat 62: explicitly refocus search annotations input field on X click to not loose focus (possible with click through voiceover shortcut)
  • vpat 64: added aria labels to annotation preview inputs in the sidebar and popup
  • vpat 65: added title to context menu button so screen readers announce what that button does
  • vpat 69: more descriptive aria-label for "tags" button in annotations preview.
  • vpat 71: added aria-labelledby and aria-describedby to the actual annotation. The first thing that will be announced is the header ("Page ...") followed by the editable area (comment or annotation text)
  • vpat 73: added tabs semantics to the sidebar component. vpat 72 states that we should have an audible announcement
    after a new tab was selected. This does not seem exactly correct per https://www.w3.org/WAI/WCAG21/Understanding/status-messages.html#excepted-examples, however the sidebar should still have proper tabbar semantics to help screen readers handle focus. That way, when a different tab is selected, the screen readers tend to repeat the title of the tab with a note that it is selected, so this should address that concern.
  • vpat 74: added aria-description to tags in selector to make it clear that clicking on a tag will filter the annotations by it. Also, added role=checkbox with aria-selected to indicate which state each tag is in.
  • vpat 79: added aria-label to "Edit page number" input

@abaevbog abaevbog force-pushed the vpat_aria_edits branch 3 times, most recently from 1665550 to 326f913 Compare June 12, 2024 17:15
@abaevbog
Copy link
Contributor Author

@mrtcode these are my fixes to simpler accessibility issues within the reader brought up by VPAT reviewers. Let me know what you think!

A few notes:

  • I kept these as a single PR so that it's possible to squash all commits into one before merging to keep the commit history somewhat clean. But correct me if I should break these into individual PRs so that it's easier to review?
  • There is a glitch in react 17 that logs a warning as if aria-description is not a valid aria property: Bug: aria-description is a valid ARIA property facebook/react#21035. It should be gone in react 18.
  • To add these accessibility fixes, I had to add some new localized strings. I don't fully understand how the localization workflow happens with the reader but I added each of the new strings that we would want into en-us.strings.js for reference. But to get them to be actually announced, I had to add those strings into zotero.properties of the main repo. Is there somewhere else I should place the new strings?

@abaevbog abaevbog marked this pull request as ready for review June 12, 2024 17:43
@mrtcode
Copy link
Member

mrtcode commented Jun 14, 2024

I kept these as a single PR so that it's possible to squash all commits into one before merging to keep the commit history somewhat clean. But correct me if I should break these into individual PRs so that it's easier to review?

I think it's fine as it is. I don't have a strong opinion on whether we want to squash the commits or not.

There is a glitch in react 17 that logs a warning as if aria-description is not a valid aria property: facebook/react#21035. It should be gone in react 18.

That warning is a bit annoying, but I'll suppress it, so it's fine.

To add these accessibility fixes, I had to add some new localized strings. I don't fully understand how the localization workflow happens with the reader but I added each of the new strings that we would want into en-us.strings.js for reference. But to get them to be actually announced, I had to add those strings into zotero.properties of the main repo. Is there somewhere else I should place the new strings?

The reader gets its localized strings from Zotero with the pdfReader and general prefixes. Even though we are now mostly using zotero.ftl, the reader can only use strings from zotero.properties. When using the reader in the browser, it falls back to using en-us.strings.js.

Anyway, it looks good, and I think you can merge it.

@abaevbog
Copy link
Contributor Author

I added here a little tweak to make the annotation text focusable without it being editable. I think it achieves what we want: the screen readers being able to read the text without having to enable editing first through the menu.

Even though we are now mostly using zotero.ftl, the reader can only use strings from zotero.properties

Ok, gotcha! So before updating the reader submodule in the main repo, we should make sure to add the new lines to zotero.properties:

pdfReader.annotationComment = Annotation comment
pdfReader.annotationText = Annotation text
pdfReader.manageTags = Click to manage tags
pdfReader.openMenu = Open menu
pdfReader.thumbnails = Thumbnails
pdfReader.tagSelectorMessage = Filter annotations by this tag

Anyway, it looks good, and I think you can merge it.

That's great! It looks like I don't have write permissions to the reader repo though. So there's no "Merge" button on my end here.

- vpat 60: added role=button and aria-label to X clear
icon of search annotations
- vpat 61: hide magnifying glass of search annotations field
from screen readers
- vpat 62: explicitly refocus search annotations input field
on X click to not loose focus (possible with voiceover)
- vpat 64: added aria labels to annotation preview inputs in sidebar
- vpat 65: added title for context menu button
- vpat 69: aria-description for "tags" button.
It will always announce that this button can be clicked
to manage tags regardless what the current label is.
Note, there is a warning logged that aria-description
in not a valid aria property - it is a bug in react 17.
- vpat 71: properly announce annotations. Added listbox and option roles
to help screen readers handle cursor movements. aria-labelledby of annotation
points at header and aria-describedby points at the editable aria of
the annotation so that the announcement is "Page ..." followed by the content of
the annotation or the comment.
- vpat:72 add tab semantics to the sidebar component
vpat 72 states that we should have an audible announcement
after a new tab was selected. This does not seem exactly correct
per https://www.w3.org/WAI/WCAG21/Understanding/status-messages.html#excepted-examples,
however the sidebar should still have proper tabbar semantics
to help screen readers handle focus. That way, when a different
tab is selected, the screen readers tend to repeat the title
of the tab with a note that it is selected, so this should
address that concern.
- vpat 73: aria properties to announce thumbnails in the side bar
- vpat 74: added description and state to tags. Added aria-description
to tags to announce that this will filter annotations by
this tag. Note that there is a warning logged that aria-description
is not a valid aria property - it is a bug in react 17.
Added role=checkbox and aria-checked state to tags to indicate which ones are toggled on
- vpat 79: aria label for "Edit page number" input

- make annotation text focusable without editing
added tabstop parameter to ExpandableEditor that
will add data-tabstop=1 and tabindex=-1 if annotation is focused
regardless of readonly state. It allows us to focus the annotation
text via tabbing without breaking existing behavior of making
the annotation text focusable and editable only on double-click.

Fixes: zotero/zotero#4220
Addresses: zotero/zotero#4222
Addresses: zotero/zotero#4223
@abaevbog abaevbog merged commit b260892 into zotero:master Jun 14, 2024
1 check passed
abaevbog added a commit to abaevbog/reader that referenced this pull request Jul 30, 2024
- vpat 63: fix focus not being able to move forward
on tab from "Search annotations" input in the sidebar
if the search result is empty. Decide if the tabstop
should be added to annotationsView based on filteredAnnotations.length
 instead of unfiltered props.annotations.length
- vpat 73: fix NVDA not properly announcing the thumbnails
view when it is selected. The "Show thumbnails" label of the view
does not get announced, instead NVDA immediately announces page label
of the selected thumbnail, which is a bit confusing. This happens
because each time the selection changes, the view is re-added into the DOM,
which tricks NVDA into thinking that there is a new component that appeared
and it needs to be announced asap.
Intead, render outline, annotations and thumbnails views and just hide
views that are not selected. Also, added "Page" prefix to thumbnails
aria labels to give it a bit more context.
Followup to zotero#127
dstillman pushed a commit that referenced this pull request Jul 31, 2024
- vpat 63: fix focus not being able to move forward
on tab from "Search annotations" input in the sidebar
if the search result is empty. Decide if the tabstop
should be added to annotationsView based on filteredAnnotations.length
 instead of unfiltered props.annotations.length
- vpat 73: fix NVDA not properly announcing the thumbnails
view when it is selected. The "Show thumbnails" label of the view
does not get announced, instead NVDA immediately announces page label
of the selected thumbnail, which is a bit confusing. This happens
because each time the selection changes, the view is re-added into the DOM,
which tricks NVDA into thinking that there is a new component that appeared
and it needs to be announced asap.
Intead, render outline, annotations and thumbnails views and just hide
views that are not selected. Also, added "Page" prefix to thumbnails
aria labels to give it a bit more context.
Followup to #127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants