From 09689e3a1c777a4dbb303f86a0d966e440f01554 Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Tue, 11 Jun 2024 15:49:39 -0400 Subject: [PATCH] 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 --- src/common/components/sidebar/annotations-view.js | 6 ++++++ src/en-us.strings.js | 1 + 2 files changed, 7 insertions(+) diff --git a/src/common/components/sidebar/annotations-view.js b/src/common/components/sidebar/annotations-view.js index f92b6802..c42e1207 100644 --- a/src/common/components/sidebar/annotations-view.js +++ b/src/common/components/sidebar/annotations-view.js @@ -42,6 +42,9 @@ function Selector({ tags, colors, authors, onContextMenu, onClickTag, onClickCol onDragOver={handleDragOver} onDragLeave={handleDragLeave} onDrop={(event) => handleDrop(event, null, color.color)} + role="checkbox" + aria-checked={color.selected} + aria-description={intl.formatMessage({ id: "pdfReader.tagSelectorMessage" })} > ))} } @@ -55,6 +58,9 @@ function Selector({ tags, colors, authors, onContextMenu, onClickTag, onClickCol onDragOver={handleDragOver} onDragLeave={handleDragLeave} onDrop={(event) => handleDrop(event, { name: tag.name, color: tag.color })} + role="checkbox" + aria-checked={tag.selected} + aria-description={intl.formatMessage({ id: "pdfReader.tagSelectorMessage" })} >{!!tag.color && }{tag.name} ))} } diff --git a/src/en-us.strings.js b/src/en-us.strings.js index f2f22bd2..42cc81a8 100644 --- a/src/en-us.strings.js +++ b/src/en-us.strings.js @@ -106,6 +106,7 @@ export default { 'pdfReader.openMenu' : 'Open menu', 'pdfReader.thumbnails' : 'Thumbnails', 'pdfReader.addTags': 'Add tagsā€¦', + 'pdfReader.tagSelectorMessage' : 'Filter annotations by this tag', 'pdfReader.highlightText': 'Highlight Text', 'pdfReader.underlineText': 'Underline Text', 'pdfReader.addNote': 'Add Note',