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 #1250: Dashboard should change fullscreen mode even when the change is triggered by the browser #1272

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions front/src/routes/dashboard/index.js
Original file line number Diff line number Diff line change
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