Skip to content

Commit 706881f

Browse files
authored
fix(FEC-8448): after 'learn more' is clicked, fullscreen button is not 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
1 parent a29ebaa commit 706881f

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/components/fullscreen/fullscreen.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class FullscreenControl extends BaseComponent {
5252
*/
5353
componentWillMount(): void {
5454
this._targetDiv = document.getElementById(this.props.targetId);
55+
if (this._isFullscreen() !== this.props.fullscreen) {
56+
this.fullscreenChangeHandler();
57+
}
5558
}
5659

5760
/**
@@ -97,13 +100,20 @@ class FullscreenControl extends BaseComponent {
97100
* @memberof FullscreenControl
98101
*/
99102
fullscreenChangeHandler(): void {
100-
const isFullscreen =
103+
this._isFullscreen() ? this.fullscreenEnterHandler() : this.fullscreenExitHandler();
104+
}
105+
106+
/**
107+
* @returns {boolean} - the current fullscreen state of the document
108+
* @memberof FullscreenControl
109+
*/
110+
_isFullscreen(): boolean {
111+
return (
101112
(typeof document.fullscreenElement !== 'undefined' && Boolean(document.fullscreenElement)) ||
102113
(typeof document.webkitFullscreenElement !== 'undefined' && Boolean(document.webkitFullscreenElement)) ||
103114
(typeof document.mozFullScreenElement !== 'undefined' && Boolean(document.mozFullScreenElement)) ||
104-
(typeof document.msFullscreenElement !== 'undefined' && Boolean(document.msFullscreenElement));
105-
106-
isFullscreen ? this.fullscreenEnterHandler() : this.fullscreenExitHandler();
115+
(typeof document.msFullscreenElement !== 'undefined' && Boolean(document.msFullscreenElement))
116+
);
107117
}
108118

109119
/**

0 commit comments

Comments
 (0)