Skip to content

Commit

Permalink
fix(FEC-8448): after 'learn more' is clicked, fullscreen button is no…
Browse files Browse the repository at this point in the history
…t responding (#261)

* checking on each full screen button render if there was a change in the full screen mode

* fix the merge

* fix the merge

* fix merge

* fix merge

* removing redundant state,

calling change handler in the component will mount function.

* dists fix
  • Loading branch information
odedhutzler committed Aug 6, 2018
1 parent a29ebaa commit 706881f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/fullscreen/fullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class FullscreenControl extends BaseComponent {
*/
componentWillMount(): void {
this._targetDiv = document.getElementById(this.props.targetId);
if (this._isFullscreen() !== this.props.fullscreen) {
this.fullscreenChangeHandler();
}
}

/**
Expand Down Expand Up @@ -97,13 +100,20 @@ class FullscreenControl extends BaseComponent {
* @memberof FullscreenControl
*/
fullscreenChangeHandler(): void {
const isFullscreen =
this._isFullscreen() ? this.fullscreenEnterHandler() : this.fullscreenExitHandler();
}

/**
* @returns {boolean} - the current fullscreen state of the document
* @memberof FullscreenControl
*/
_isFullscreen(): boolean {
return (
(typeof document.fullscreenElement !== 'undefined' && Boolean(document.fullscreenElement)) ||
(typeof document.webkitFullscreenElement !== 'undefined' && Boolean(document.webkitFullscreenElement)) ||
(typeof document.mozFullScreenElement !== 'undefined' && Boolean(document.mozFullScreenElement)) ||
(typeof document.msFullscreenElement !== 'undefined' && Boolean(document.msFullscreenElement));

isFullscreen ? this.fullscreenEnterHandler() : this.fullscreenExitHandler();
(typeof document.msFullscreenElement !== 'undefined' && Boolean(document.msFullscreenElement))
);
}

/**
Expand Down

0 comments on commit 706881f

Please sign in to comment.