Skip to content
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 chapters menu #3163

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/css/components/_chapters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
@extend .vjs-icon-chapters;
}

.vjs-chapters-button .vjs-menu {
left: -10em; // (Width of vjs-menu - width of vjs-control) / 2
width: 0;
}

.vjs-chapters-button .vjs-menu ul {
width: 24em;
}
6 changes: 4 additions & 2 deletions src/js/control-bar/text-track-controls/chapters-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ class ChaptersButton extends TextTrackButton {
let menu = this.menu;
if (menu === undefined) {
menu = new Menu(this.player_);
menu.contentEl().appendChild(Dom.createEl('li', {
let title = Dom.createEl('li', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1/. Since this is a new Menu, what's the situation where it can have children already?

2/. meun-button.js already has this mechanism to add a title (using options.title) which doesn't seem to be used elsewhere - why isn't that mecanism used here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's unlikely that it should be a problem, especially since it should be the first item.
  2. I'll have to take a look at that and see whether it applies in this case or what its used for. Thanks.

className: 'vjs-menu-title',
innerHTML: toTitleCase(this.kind_),
tabIndex: -1
}));
});
menu.children_.unshift(title);
Dom.insertElFirst(title, menu.contentEl());
}

if (chaptersTrack && chaptersTrack.cues == null) {
Expand Down