Skip to content

NVDA screen reader does not read the aria-label in fast-anchor and fast-button web component #3248

@khamudom

Description

@khamudom

Since there has been talk to make NVDA the primary screen reader used for testing, I have been looking into resolving this issue.

Describe the bug; what happened?
When adding an aria-label attribute to fast-anchor or fast-button, native screen readers, like VoiceOver and Narrator will read the aria-label, but NVDA will not.

Repo steps:

  1. Add aria-label to fast-anchor or fast-button to a host element.
  2. Run NVDA and tab to the link or button
  3. Notice NVDA does not read the aria-label

What behavior did you expect?
NVDA should read what aria-label

Upon further investigation, adding the aria-label to the component does not set an aria-label to control inside the shadow root.

Here is the markup:
image

When inspecting the DOM, you see the anchor in the shadow root does not have an aria-label set on it.
image

Two things:

  1. This could be an issue with NVDA, where it doesn't read aria-labels on our custom web components. We file an issue with them to investigate why.
    or
  2. We need to set aria-label in the template so it will pass aria-label onto the control inside the shadow root.

Here is the proposed fix is to pass aria-label to the control inside the shadow root if we choose this route.

Add an aria-label attribute to the anchor tag inside the fast-anchor template.
image

Add an aria-label attribute to the button tag inside the fast-button template.
image

Now when inspecting the DOM, you see that aria-label is also added in the anchor control.
image

NVDA will now read out the aria-label.

Side note:
Another issue I noticed adding aria-label. Typically the screen reader should only read the aria-label and not the content text. In the case of our fast-anchor and fast-button, the screen reader is reading both the aria-label and the content text.

example:
image

The screen reader should only read out "go play Destiny, link".
Instead, it is reading out
"go play Destiny, link, Titanfall" (Narrator)
"link, Titanfall, go play Destiny" (VoiceOver)

The proposal fix will also resolve the screen reader from also reading out the content text when aria-label is added. My guess on this is because all the screen readers now reading an aria-label on HTML control.

Even though NVDA gets resolved, and reading the aria-label only gets resolved (on all 3 screen reader), it brings up another issue.
VoiceOver will now read the aria-label twice. My guess is, it is reading the aria-label on the template and on the control.
image

The question is, what is the correct approach, and which screen reader is right or wrong or buggy?
Do we file an issue with NVDA, for not reading the aria-label on the DOM level, or is it an issue with VoiceOver, for reading both aria-label on both the DOM and shadow root level?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions