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: fullscreen controls not shown in IE11 #588

Merged
merged 2 commits into from
Jan 17, 2018
Merged

Conversation

DanDeMicco
Copy link
Contributor

When IE11 was fullscreened it cut off the bottom controls. This was due to a class that gets added when the header is present. The class is supposed to be removed in fullscreen and preview should be shifted up, so the controls won't be cut off.

The issue occured because there was multiple event listeners which got added in the constructor of Fullscreen.js due to the fullscreen API sometimes requiring vendor prefixes Fullscreen API. This caused the toggle function to be called an even number of times, thus removing and re-adding the header class.

Following the suggestion from MDN, I added fscreen to resolve the cross browser differences and only add 1 event listener instead of 4.

@boxcla
Copy link

boxcla commented Jan 16, 2018

Hi @DanDeMicco, thanks for the pull request. Before we can merge it, we need you to sign our Contributor License Agreement. You can do so electronically here: http://opensource.box.com/cla

Once you have signed, just add a comment to this pull request saying, "CLA signed". Thanks!

@DanDeMicco
Copy link
Contributor Author

CLA signed

document.addEventListener('fullscreenchange', this.fullscreenchangeHandler);
// as of now (1/12/18) fullscreenchange is not universally adopted, fscreen will
// detect and add the appropriate vendor prefixed event
fscreen.addEventListener('fullscreenchange', this.fullscreenchangeHandler);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a unit test to check that only one handler is added per vendor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a UT + some refactoring to the PR

@@ -1,4 +1,6 @@
import EventEmitter from 'events';
import fscreen from 'fscreen';
Copy link
Contributor

Choose a reason for hiding this comment

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

I would change all functions below to also use it...so that we don't have a mix of native vs lib.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@priyajeet I will create a ticket to refactor this file

Slight refactor of Fullscreen.js to have separate methods for binding and unbinding events for testing purposes as spies werent working. Also added destroy function as events werent being unbound.
@DanDeMicco DanDeMicco merged commit e3d0f5c into box:master Jan 17, 2018
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

Successfully merging this pull request may close these issues.

6 participants