Skip to content

LG-5632 Document Capture Field label for screen readers#5858

Merged
theabrad merged 6 commits intomainfrom
abradley-lg-5632-doc-capture-aria-label
Jan 28, 2022
Merged

LG-5632 Document Capture Field label for screen readers#5858
theabrad merged 6 commits intomainfrom
abradley-lg-5632-doc-capture-aria-label

Conversation

@theabrad
Copy link
Copy Markdown
Contributor

Why In the document capture field for IAL2 the screen reader needs
to tell the user the label for the document rather than the filename.
The filename isn't descriptive while a screen reader stating "Front of your ID" or "Back of your
ID" provides more context to the user.

**Why** In the document capture field for IAL2 the screen reader needs
to tell the user the label for the document rather than the filename.
The filename isn't descriptive while a screen reader stating "Front of your ID" or "Back of your
ID" provides more context to the user.
function getInputAriaLabel(label, fileValue) {
if (fileValue instanceof window.File) {
return fileValue.name;
return label;
Copy link
Copy Markdown
Contributor

@aduth aduth Jan 25, 2022

Choose a reason for hiding this comment

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

Since there's already a <label> associated with the input, do we need aria-label with the same text? We may just be able to remove the aria-label and it would have the same effect, but that would also bring us back to how it worked prior to #5691 (cc @mdiarra3).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can confirm. The aria-label is not needed if this is the expected result.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yea is stating "no file chosen" after a file has been uploading, so if we could possibly include the label as well as file name when uploaded that may be ideal.

@mitchellhenke
Copy link
Copy Markdown
Contributor

Could you add an entry to the changelog? 🙂

Removed aria-label from file input entirely so now the screen reader
will just pick up the <label> tag.
The aria-label will now say [Front or Back] of your ID - [filename] on a
screenreader when a document is uploaded.
function getLabelFromValue(fileLabel, fileValue) {
if (fileValue instanceof window.File) {
return fileValue.name;
return `${fileLabel} - ${fileValue.name}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we include the label in all of the possible return paths of this function, not just the one where we know the file's name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I added a label to the second return statement. The last return path doesn't need it. I tested with a screen reader and it looks like the label field will take precedence over that.

Copy link
Copy Markdown
Contributor

@aduth aduth 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 👍

@theabrad theabrad merged commit 400bf56 into main Jan 28, 2022
@theabrad theabrad deleted the abradley-lg-5632-doc-capture-aria-label branch January 28, 2022 20:54
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.

4 participants