-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(subs-caps-button): captions items should hide icon from SR (#4158)
Move the CC icon in the SubsCapsMenuItem into an icon-placeholder span. Also, include that information for the screen reader. In addition, only apply default sizing to icon-placeholder if they're direct descendants of a vjs-control.
- Loading branch information
Showing
5 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/js/control-bar/text-track-controls/subs-caps-menu-item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @file subs-caps-menu-item.js | ||
*/ | ||
import TextTrackMenuItem from './text-track-menu-item.js'; | ||
import Component from '../../component.js'; | ||
import {assign} from '../../utils/obj'; | ||
|
||
/** | ||
* SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles | ||
* in the SubsCapsMenu. | ||
* | ||
* @extends TextTrackMenuItem | ||
*/ | ||
class SubsCapsMenuItem extends TextTrackMenuItem { | ||
|
||
createEl(type, props, attrs) { | ||
let innerHTML = `<span class="vjs-menu-item-text">${this.localize(this.options_.label)}`; | ||
|
||
if (this.options_.track.kind === 'captions') { | ||
innerHTML += ` | ||
<span aria-hidden="true" class="vjs-icon-placeholder"></span> | ||
<span class="vjs-control-text"> ${this.localize('Captions')}</span> | ||
`; | ||
} | ||
|
||
innerHTML += '</span>'; | ||
|
||
const el = super.createEl(type, assign({ | ||
innerHTML | ||
}, props), attrs); | ||
|
||
return el; | ||
} | ||
} | ||
|
||
Component.registerComponent('SubsCapsMenuItem', SubsCapsMenuItem); | ||
export default SubsCapsMenuItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters