Skip to content

Commit

Permalink
Fix #1250: Dashboard should change fullscreen mode even when the chan…
Browse files Browse the repository at this point in the history
…ge is triggered by the browser (#1272)
  • Loading branch information
Pierre-Gilles committed Sep 3, 2021
1 parent 9cce905 commit d61b9b8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions front/src/routes/dashboard/index.js
Expand Up @@ -289,6 +289,11 @@ class Dashboard extends Component {
}
};

onFullScreenChange = () => {
const isFullScreen = this.isFullScreen();
this.props.setFullScreen(isFullScreen);
};

constructor(props) {
super(props);
this.props = props;
Expand All @@ -303,6 +308,9 @@ class Dashboard extends Component {

componentDidMount() {
this.init();
document.addEventListener('fullscreenchange', this.onFullScreenChange, false);
document.addEventListener('webkitfullscreenchange', this.onFullScreenChange, false);
document.addEventListener('mozfullscreenchange', this.onFullScreenChange, false);
}

componentDidUpdate(prevProps) {
Expand All @@ -311,6 +319,12 @@ class Dashboard extends Component {
}
}

componentWillUnmount() {
document.removeEventListener('fullscreenchange', this.onFullScreenChange, false);
document.removeEventListener('webkitfullscreenchange', this.onFullScreenChange, false);
document.removeEventListener('mozfullscreenchange', this.onFullScreenChange, false);
}

render(
props,
{
Expand Down

0 comments on commit d61b9b8

Please sign in to comment.