Skip to content

Commit

Permalink
fix: disable title attribute on menu items (#4019)
Browse files Browse the repository at this point in the history
Prevents a title attribute from being applied to MenuItems.
MenuItem indicates to ClickableComponent that the control is not just an icon, so it shouldn't have a title attribute.

Fixes #3699
  • Loading branch information
OwenEdwards authored and gkatsev committed Feb 2, 2017
1 parent 29c6141 commit 04f23c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/js/clickable-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class ClickableComponent extends Component {

this.controlText_ = text;
this.controlTextEl_.innerHTML = localizedText;
el.setAttribute('title', localizedText);
if (!this.nonIconControl) {
// Set title attribute if only an icon is shown
el.setAttribute('title', localizedText);
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/js/menu/menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class MenuItem extends ClickableComponent {
* The element that gets created.
*/
createEl(type, props, attrs) {
// The control is textual, not just an icon
this.nonIconControl = true;

return super.createEl('li', assign({
className: 'vjs-menu-item',
innerHTML: this.localize(this.options_.label),
Expand Down

0 comments on commit 04f23c1

Please sign in to comment.