-
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
feat: fix accessibility of the captions setting dialog #4050
Conversation
@OwenEdwards I'm not sure how the "extent" is supposed to be specified. |
Here's the idea of the "extent" of the dialog: The top and bottom of the dialog area are clearly marked for sighted users. Focus is constrained inside the dialog, but a screen reader user can use the up and down arrow keys to move the "virtual cursor" and read content which isn't focusable/actionable. If they move out of the top or bottom of the dialog and into other content in the DOM, they may not realize that this has happened, and may become confused/lost. The preferred solution is to use
Alternatively, you can use hidden (screen reader only) text to say "Start of modal dialog", "End of modal dialog" at exactly the place where the extent of the dialog is visibly marked in the DOM. There has been some talk that marking an ARIA |
It sounds like have a "start" and "end" elements that are only available to screen readers is what we want. |
Right, and I forgot that we already have |
@OwenEdwards this is ready for testing. Only issue is #4049. |
@OwenEdwards I'm not really sure how to improve the highlighting of the The others can definitely be fixed and I've already fixed the last one. |
I decided to update it so that it re-focuses on the captions button when it is closed. |
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.
Tested with IE11 & JAWS - a couple of changes needed. Also, it's failing one of the tests: ModalDialog should create the expected description element
.
src/js/tracks/text-track-settings.js
Outdated
}), | ||
createEl('select', {id}, undefined, config.options.map(o => { | ||
createEl('select', {}, { | ||
'aria-labeledby': `${legendId} ${id}` |
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.
TYPO? aria-labelledby
isn't spelled the way you'd expect!
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.
Yup, oops.
src/js/tracks/text-track-settings.js
Outdated
textContent: this.localize(o[1]), | ||
value: o[0] | ||
}, { | ||
'aria-labeledby': `${legendId} ${id} ${optionId}` |
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 don't need to aria-label
each <option>
, only the <select>
.
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.
I was testing with voiceover on mac. Seems like Safari reads it out like White, Text Color, menu item
but on chrome it reads it out only as white
unless I add this labelledby
.
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.
It looks like several methods of TextTrackSettings
are missing JSDoc comments.
@misteroneill all the missing jsdocs are fixed by adding |
textContent: this.localize(o[1]), | ||
value: o[0] | ||
}, { | ||
'aria-labelledby': `${legendId} ${id} ${optionId}` |
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.
@OwenEdwards did we have an answer whether we should keep this because of VO and Chrome or remove it?
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.
I'm a little concerned about how well this will work - there's a circular reference where the label for this element includes the id
of two other elements, and then the id of this element. The behavior in this situation is mentioned in the W3C Accessible Name Computation - Text Alternative Computation:
if computing a name, and the current node has a non-empty aria-labelledby attribute, and the current node is not already part of an aria-labelledby traversal, process its IDREFs in the order they occur:
but it may not work correctly in all browsers. I guess we'll just have to fix it if that happens?
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.
from the little I understand about this, I think it should be fine and it falls within what the spec allows.
I'm 👌 with leaving this and then fixing in the future if we find an issue.
textContent: this.localize(o[1]), | ||
value: o[0] | ||
}, { | ||
'aria-labelledby': `${legendId} ${id} ${optionId}` |
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.
I'm a little concerned about how well this will work - there's a circular reference where the label for this element includes the id
of two other elements, and then the id of this element. The behavior in this situation is mentioned in the W3C Accessible Name Computation - Text Alternative Computation:
if computing a name, and the current node has a non-empty aria-labelledby attribute, and the current node is not already part of an aria-labelledby traversal, process its IDREFs in the order they occur:
but it may not work correctly in all browsers. I guess we'll just have to fix it if that happens?
* update caption settings button styles * minor button style updates
e30adff
to
1946cbe
Compare
src/js/tracks/text-track-settings.js
Outdated
const defaultsButton = createEl('button', { | ||
className: 'vjs-default-button', | ||
textContent: this.localize('Defaults') | ||
title: defaultsDescription, | ||
innerHTML: `${this.localize('Defaults')}<span class='vjs-control-text'> - ${defaultsDescription}</span>` |
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.
@OwenEdwards @mmcc brought up that maybe 'Reset' would be a better name for this button, thoughts?
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.
I think that would work fine - if the button is marked 'Reset', then the hidden text can be ' all settings to the default values', and you don't need the ' - ' in the hidden text.
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.
Reset seems like a better name to me
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.
+1
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.
Updated.
@@ -457,6 +485,10 @@ class TextTrackSettings extends Component { | |||
* The element that was created. | |||
*/ | |||
createEl() { | |||
return super.createEl(); |
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.
I don't know if we need this here, won't this be the default behavior?
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.
Um... yeah, probably not needed.
return super.createEl(); | ||
} | ||
|
||
content() { |
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.
This function and a few of the funcitons below this need jsdoc comments
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.
JSDoc gets them from the parent.
This fixes a lot of the issues from #2746 by making the dialog inherit from our actual ModalDialog which now has tab focus trapping.
Todo copied from #2746 to track what has been fixed. #2746 should be used to track what has been verified as fixed.
The Captions Settings dialog has some accessibility issues: