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

Never let the player get focus #44

Closed
Fruitsapje opened this issue Jun 16, 2017 · 3 comments
Closed

Never let the player get focus #44

Fruitsapje opened this issue Jun 16, 2017 · 3 comments

Comments

@Fruitsapje
Copy link

Hi there,

I have an issue where the player gets focus when alwaysCaptureHotkeys is set to false and autoplay is active. This means that the page will jump to the player on pageload if autoplay is active.

This happens because we handle autoplay in a different way in order to do certain detections before we 'autoplay' the video. In short this causes autoplay to be set to false when the player gets initialized, while still starting the video, and therefor it passes the following if statement of the hotkeys code:

if (alwaysCaptureHotkeys || !player.autoplay()) {
      player.one('play', function() {
        pEl.focus(); // Fixes the .vjs-big-play-button handing focus back to body instead of the player
      });
 }

Is it possible to get an option created where we can set the player to never get focus? Something like neverAllowFocus for example. which will ignore this whole if statement if set to true?

Thanks in advance

@ctd1500
Copy link
Owner

ctd1500 commented Jun 16, 2017

Can't do an option to never allow focus, but a skipInitialFocus should be fine

if (alwaysCaptureHotkeys || !player.autoplay()) {
    if (!skipInitialFocus) {
        player.one('play', function() {
          pEl.focus(); // Fixes the .vjs-big-play-button handing focus back to body instead of the player
        });
    }
 }

@Fruitsapje
Copy link
Author

That would be perfect for us as well!

ctd1500 added a commit that referenced this issue Jun 17, 2017
@Fruitsapje
Copy link
Author

The commit looks to fit our needs, thanks! Any estimate when you will release a new package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants