Skip to content

Commit

Permalink
fix: wave a11y errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tsi committed Dec 14, 2023
1 parent 6dcefab commit bf551c6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/components/jumpButtons/jump-10-minus.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class JumpBackButton extends ClickableComponent {

createEl() {
return videojs.dom.createEl('button', {
className: 'vjs-control vjs-icon-skip-10-min vjs-icon-replay-10 vjs-button'
className: 'vjs-control vjs-icon-skip-10-min vjs-icon-replay-10 vjs-button',
ariaLabel: 'Jump back 10 seconds'
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/jumpButtons/jump-10-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class JumpForwardButton extends ClickableComponent {

createEl() {
return videojs.dom.createEl('button', {
className: 'vjs-control vjs-icon-skip-10-plus vjs-icon-forward-10 vjs-button'
className: 'vjs-control vjs-icon-skip-10-plus vjs-icon-forward-10 vjs-button',
ariaLabel: 'Jump forward 10 seconds'
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/playlist/components/playlist-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class PlaylistButton extends ClickableComponent {
return videojs.dom.createEl('button', {
// Prefixing classes of elements within a player with "vjs-"
// is a convention used in Video.js.
className: `vjs-control vjs-playlist-button vjs-button ${typeCssClass}`
className: `vjs-control vjs-playlist-button vjs-button ${typeCssClass}`,
ariaLabel: `Playlist ${type} item`
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ class RecommendationsOverlayPrimaryItem extends RecommendationsOverlayItem {
className: 'vjs-recommendations-overlay-item-primary-image'
});

this.title = dom.createEl('h2');
this.title = dom.createEl('h2', {
ariaLabel: 'Recmmendation Title'
});
this.setAriaCheck(this.title, false);
this.title.innerHTML = '';

this.subtitle = dom.createEl('h3');
this.subtitle = dom.createEl('h3', {
ariaLabel: 'Recmmendation Subtitle'
});
this.setAriaCheck(this.subtitle, false);
this.subtitle.innerHTML = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class SourceMenuButton extends MenuButton {
constructor(player, options) {
super(player, options);


const qualityLevels = this.player().qualityLevels();

// Handle options: We accept an options.default value of ( high || low )
Expand All @@ -29,6 +28,8 @@ class SourceMenuButton extends MenuButton {
this.player().qualityLevels().on('addqualitylevel', (event) => {
this.update(event);
});

this.menuButton_.el_.setAttribute('aria-label', 'Source Selector Button');
}

createEl() {
Expand Down
4 changes: 4 additions & 0 deletions src/video-player.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export const overrideDefaultVideojsComponents = () => {

// Position the 'logo-button' button last
children.push('logoButton');

// Remove these button
children.splice(children.indexOf('skipForward'), 1);
children.splice(children.indexOf('skipBackward'), 1);
}

const SeekBar = videojs.getComponent('SeekBar');
Expand Down

0 comments on commit bf551c6

Please sign in to comment.