-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: current time and duration display accessibility with VoiceOver #5653
Conversation
b99d9e8
to
cbcc93b
Compare
// this element and its contents can be hidden from assistive techs since | ||
// it is made extraneous by the announcement of the control text | ||
// for the current time and duration displays | ||
innerHTML: '<div aria-hidden="true"><span>/</span></div>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than it being added at this level, we should make the main time-divider div be aria-hidden, super.createEl may accent a 3rd argument object for properties, if not, you can use Dom.createEl directly and return that.
I've got to say that I don't like this at all. There is no "standard" for how screen readers implement their Virtual Cursor mode (moving through all DOM content with the arrow keys, rather than just moving through active elements with Tab/Shift-Tab), and for a long time VoiceOver has treated This PR is also using ARIA in a non-standard way that may get flagged by conformance checking and accessibility checking tools. According to https://www.w3.org/TR/html-aria/, the role of a |
@OwenEdwards Makes sense to me. I was tasked with investigating a workaround, but I'm perfectly content leaving things as is and calling it an expected VoiceOver behavior. A couple follow-up questions: 1) Is it still reasonable to hide the TimeDivider "/" from readers, or do you think that should remain visible as well? 2) What specifically in this PR might get flagged by conformance-checking tools? Do you mean that adding a |
@alex-barstow I try to keep this work separate from my "day job", but I talked it over with some of my smartest colleagues, and I'm going to admit that I was wrong. In general there are real issues about applying ARIA roles to HTML elements where the role matches the implicit role of the element, and I thought that this was true in this case. I now understand that it's not - a So I change my review, with my appologies. And yes, I do think that hiding the "/" from screen readers makes sense, in the same way that I recommended in #5168 that the "-" be hidden from screen readers; as you say, the additional information for screen reader users makes these visual elements redundant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion for a change in a comment, otherwise LGTM.
}); | ||
|
||
this.contentEl_ = Dom.createEl('span', { | ||
className: `${className}-display` | ||
}, { | ||
// tell screen readers not to automatically read the time as it changes | ||
'aria-live': 'off' | ||
'aria-live': 'off', | ||
// span elements should have no implicit role semantics, but make this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could change this comment to "span elements have no implicit role, but some screen readers (notably VoiceOver) treat them as a break between items in the DOM when using arrow keys (or left-to-right swipes on iOS) to read contents of a page. Using role='presentation' causes VoiceOver to NOT treat this span as a break."
Tested with JAWS, VoiceOver, and NVDA -- I'm seeing the correct behavior with all three |
We might want to make similar changes elsewhere, including in #5655. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Alex! 👍
Description
The desired behavior when navigating any of the TimeDisplay components (current time, duration, remaining time) with the arrow keys with a screen reader is for the singular parent div to receive focus, and the reader should announce the text of each child span in order, ex. "Current Time 0:17" and "Duration 1:10". This is how it works when using JAWS. However, with VoiceOver each individual child span element receives focus and the contents are announced separately:
Screenshot of 1st span - control text
Screenshot of 2nd span - numerical time
According to the ARIA spec (see here and example 8), there is no implicit role for span elements, so the contents should be exposed but the elements themselves should be invisible to screen readers. In other words,
<span> Sample Content </span>
should be the same as<span role="presentation"> Sample Content </span>
. But this is not the case with VoiceOver. As far as I can tell, the desired behavior is only achieved with VoiceOver if each child span is explicitly made presentational, either by assigning each of them thepresentation
role, or by assigning the parent div a role that makes its children presentational (although there doesn't seem to be a role whose semantics fit the purpose of that div)The first ARIA doc link above shows the Mac OS X Accessibility Protocol mapping for span elements is to the
group
role. I don't know enough about accessibility API mapping to confidently draw conclusions about root cause, but this seems like a possible explanation. Pinging @gkatsev and @OwenEdwards for your expertise on this.Proposed Additions
role="presentation"
to each of the two span elements inside TimeDisplay divsaria-hidden="true
to the TimeDivider (tangential improvement)