-
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
Keep tooltips inside #3149
Keep tooltips inside #3149
Conversation
This apparently doesn't work in firefox. Firefox always returns |
I found this firefox issue while trying to create an example on plnkr http://plnkr.co/edit/91wBL105FIOLuEf9JNxG?p=preview |
This reverts commit d460a8b.
I believe this is ready to be reviewed now. I want to add a simple test that verifies that the correct elements are created when the option is set. Also, maybe some unit tests for some of the new methods like |
|
||
if (this.keepTooltipsInside) { | ||
this.el().innerHTML = `<div class='vjs-time-tooltip'>`; | ||
this.tooltip = this.el().querySelector('.vjs-time-tooltip'); |
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 wonder if this would be preferable to adding to the DOM then querying it?
this.tooltip = Dom.createEl('div', {className: 'vjs-time-tooltip'});
this.el().appendChild(this.tooltip);
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.
that's probably better.
LGTM |
Description
Add a new option that makes the tooltips stay inside the bounds of the player.
Specific Changes proposed
The new option is
keepWithin
and it's part of theprogressControl
. A new option is required because we can't change the defaults and the changes herein would be breaking otherwise.Basically, we create a new progress control that we use for the tooltip which we bound with
min-width
andmax-width
to be half the width of the tooltip plus player-width minus half the width of the tooltip.Also, this is an option because the default videojs skin doesn't have the progress bar go edge-to-edge of the player, so, there's no need to do the extra computations then. But if a skin uses an edge-to-edge progress bar and likes the time tooltips, then, this will be beneficial.
This contains the first attempt at doing this as well as part of the first commit.
Requirements Checklist
keepWithin
optionkeepWithin
tokeepTooltipsInside
or something