Skip to content

Commit

Permalink
fix(Windows + Linux): Fix not clickable window titlebar & menu
Browse files Browse the repository at this point in the history
Remove need for #portalContainer
  • Loading branch information
adlk committed Mar 22, 2022
1 parent 261a977 commit 8fde4ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 35 deletions.
34 changes: 9 additions & 25 deletions src/containers/settings/SettingsWindow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import { observer, inject } from 'mobx-react';

Expand All @@ -11,18 +10,6 @@ import ErrorBoundary from '../../components/util/ErrorBoundary';
import { workspaceStore } from '../../features/workspaces';

export default @inject('stores', 'actions') @observer class SettingsContainer extends Component {
portalRoot = document.querySelector('#portalContainer');

el = document.createElement('div');

componentDidMount() {
this.portalRoot.appendChild(this.el);
}

componentWillUnmount() {
this.portalRoot.removeChild(this.el);
}

render() {
const { children, stores } = this.props;
const { closeSettings } = this.props.actions.ui;
Expand All @@ -35,18 +22,15 @@ export default @inject('stores', 'actions') @observer class SettingsContainer ex
/>
);

return ReactDOM.createPortal(
(
<ErrorBoundary>
<Layout
navigation={navigation}
closeSettings={closeSettings}
>
{children}
</Layout>
</ErrorBoundary>
),
this.el,
return (
<ErrorBoundary>
<Layout
navigation={navigation}
closeSettings={closeSettings}
>
{children}
</Layout>
</ErrorBoundary>
);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<div class="window-draggable"></div>
<div class="dev-warning">DEV MODE</div>
<div id="root"></div>
<div id="portalContainer"></div>
<script>
document.querySelector('body').classList.add(process.env.OS_PLATFORM ? process.env.OS_PLATFORM : process.platform);

Expand Down
1 change: 0 additions & 1 deletion src/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<!-- <div class="window-draggable"></div> -->
<!-- <button class="dev-warning" onclick="window.close()" style="pointer-events:all;">DEV MODE</button> -->
<div id="root"></div>
<div id="portalContainer"></div>
<script>
document.querySelector('body').classList.add(process.env.OS_PLATFORM ? process.env.OS_PLATFORM : process.platform);

Expand Down
8 changes: 0 additions & 8 deletions src/styles/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,4 @@ body.win32 .window-draggable {
width: auto;
z-index: 999999999;
pointer-events: none;
}

#portalContainer {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

0 comments on commit 8fde4ab

Please # to comment.