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

Control text fullscreen fix on ESC #3485

Closed
wants to merge 10 commits into from

Conversation

vdeshpande
Copy link
Contributor

Description

This PR is to make sure the correct control text is displayed on the Fullscreen button after pressing the ESC key while in Fullscreen mode.

Current Status:
(Steps to reproduce)

  1. Load the player on a page.
  2. Press the fullscreen button, the player goes into fullscreen mode.
  3. Hit the ESC key on your keyboard, and the player will go back to normal mode, however the control text on fullscreen button does not change or revert back to text as Fullscreen. It reads as Non-Fullscreen which is not correct.

After this fix:
Follow Step 1 and Step 2 as above. Press the ESC key and the control text should now revert back to the correct text as Fullscreen

Before this fix (current scenario)
before_fix_fullscreen
After this fix
after_fix_fullscreen

Specific Changes proposed

The changes made in this fix makes sure that we have the correct control text when you exit fullscreen mode.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

@@ -1092,6 +1092,8 @@ class Player extends Component {
this.addClass('vjs-fullscreen');
} else {
this.removeClass('vjs-fullscreen');
// Making sure the Control text reverts back after pressing ESC
this.controlBar.fullscreenToggle.controlText('Fullscreen');
Copy link
Member

Choose a reason for hiding this comment

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

the fullscreen toggle handles the control text changes. We should make that component handle this use case correctly as well.

@mister-ben
Copy link
Contributor

Currently the control's text updates even when an attempt to switch to fullscreen is unsuccessful, such as when in an iframe without allowfullscreen - example. It would be good to fix that here too.

@@ -28,6 +28,7 @@ class ClickableComponent extends Component {
this.on('click', this.handleClick);
this.on('focus', this.handleFocus);
this.on('blur', this.handleBlur);
player.on('fullscreenchange', this.handleFullscreenChange);
Copy link
Member

Choose a reason for hiding this comment

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

why not do this only in fullscreen-toggle? Generic clickable-components don't need to know about it.

@gkatsev
Copy link
Member

gkatsev commented Aug 2, 2016

There are test failures.

}
else {
this.removeClass('vjs-fullscreen');
this.controlBar.fullscreenToggle.controlText('Fullscreen');
Copy link
Member

Choose a reason for hiding this comment

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

we should make sure the context for this method is the fullscreen toggle itself, otherwise it can be super confusing.

@gkatsev
Copy link
Member

gkatsev commented Aug 2, 2016

Also, would be nice to get a test for this, I think it'll just go into the test/unit/controls.js.

* @method handleFullscreenChange
*/
handleFullscreenChange() {
let fst = this.player().controlBar.fullscreenToggle;
Copy link
Member

Choose a reason for hiding this comment

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

This seems unreliable - making the change that @gkatsev suggests would mean that fst would be entirely replaced in this method by this, which would make FullscreenToggle much more robust and extensible.

@misteroneill
Copy link
Member

I think this needs to be brought up to date with master because automated linting via videojs-standard has been added there.

@vdeshpande
Copy link
Contributor Author

@misteroneill How do the above changes look ?

@gkatsev
Copy link
Member

gkatsev commented Aug 8, 2016

I think something went wrong in the rebase. You have extra commits in this branch now.

# The first commit's message is:
Squashing commits and rebasing

Making changes to take into consideration fullscreen change on component

Making proposed changes

Removing test commented code

Making the necessary changes and adding a test

# The 2nd commit message will be skipped:

#	Adding the correct style to the test

# The 3rd commit message will be skipped:

#	Removing duplicate instance of same test
Making changes to take into consideration fullscreen change on component

Making proposed changes

Removing test commented code

Making the necessary changes and adding a test
@misteroneill
Copy link
Member

LGTM

constructor(player, options) {
super(player, options);
this.on(player, 'fullscreenchange', this.handleFullscreenChange);
}
Copy link
Member

Choose a reason for hiding this comment

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

new line after this and before the next comment.

@gkatsev
Copy link
Member

gkatsev commented Aug 9, 2016

One super small comment

@vdeshpande
Copy link
Contributor Author

@gkatsev done

@misteroneill
Copy link
Member

My LGTM still applies 😄

@brandonocasey
Copy link
Contributor

LGTM

@gkatsev gkatsev added confirmed patch This PR can be added to a patch release. labels Aug 10, 2016
@gkatsev gkatsev closed this in 2c84f45 Aug 15, 2016
@DerekCalder
Copy link

This bug has returned. It is exactly as described in the original Description. I see it happening with version 7.6.6 in Chrome and Firefox. Here is a jsfiddle where it can be reproduced: https://jsfiddle.net/fzkLhs7e/1/. Should I open a new issue for this?

@gkatsev
Copy link
Member

gkatsev commented Jan 28, 2020

Generally, best to open new issues for this as commenting on old things will likely get lost. Almost lost this but remembered seeing a comment about it as I'm currently refactoring our fullscreen support.

@gkatsev
Copy link
Member

gkatsev commented Jan 29, 2020

I believe it will be fixed as part of #6422.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed patch This PR can be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants