-
Notifications
You must be signed in to change notification settings - Fork 116
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
Conversation
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! |
CLA signed |
src/lib/Fullscreen.js
Outdated
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); |
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.
Can you add a unit test to check that only one handler is added per vendor?
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.
Added a UT + some refactoring to the PR
@@ -1,4 +1,6 @@ | |||
import EventEmitter from 'events'; | |||
import fscreen from 'fscreen'; |
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 would change all functions below to also use it...so that we don't have a mix of native vs lib.
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.
@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.
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.