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: Mobile keyboard was hiding bottom application bar #2353

Merged
merged 2 commits into from Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,6 +22,7 @@ along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
max-height: 100%;
display: flex;
flex-direction: column;
padding-bottom: env(keyboard-inset-height);
}

.root :global(.sidebar) {
Expand Down
Expand Up @@ -42,6 +42,8 @@ import {
import { getActiveScreen } from "model/selectors/getActiveScreen";
import { CDialogContent } from "gui/connections/CDialogContent";
import "gui/connections/MobileComponents/mobile.module.scss"
import { observable } from "mobx";
import { viewportHeight } from "gui/Components/ScreenElements/Table/TableRendering/renderingValues";

@observer
export class MobileMain extends React.Component<{}> {
Expand All @@ -60,11 +62,25 @@ export class MobileMain extends React.Component<{}> {
return getAbout(this.context.application);
}

@observable.ref
rootStyle: {[key: string] : string} | undefined;

componentDidMount() {
if (!getActiveScreen(this.workbench)) {
this.mobileState.layoutState = new MenuLayoutState();
}
this.about.update();
window.visualViewport?.addEventListener("resize", (event) => this.onResize());
}
componentWillUnmount() {
window.visualViewport?.removeEventListener("resize", (event) => this.onResize());
}

private onResize() {
const keyboardHeight = viewportHeight.get() - (VisualViewport as any).height;
if (keyboardHeight > 0) {
this.rootStyle = {"padding-bottom": keyboardHeight + "px"};
}
}

renderMainPageContents() {
Expand Down Expand Up @@ -101,7 +117,8 @@ export class MobileMain extends React.Component<{}> {

render() {
return (
<div className={S.root}>
<div className={S.root} style={this.rootStyle}>
{this.rootStyle ? this.rootStyle["padding-bottom"] : null}
<TopToolBar mobileState={this.mobileState}/>
{this.renderMainPageContents()}
<CDialogContent/>
Expand Down
3 changes: 3 additions & 0 deletions frontend-html/src/index.tsx
Expand Up @@ -55,6 +55,9 @@ if (import.meta.env.DEV) {
axios.defaults.timeout = 3600000;
(window as any).ORIGAM_CLIENT_AXIOS_LIB = axios;
}
if ("virtualKeyboard" in navigator) {
(navigator.virtualKeyboard as any).overlaysContent = true;
}

(window as any).ORIGAM_CUSTOM_CLIENT_BUILD = import.meta.env.VITE_REACT_APP_ORIGAM_CUSTOM_CLIENT_BUILD;
(window as any).ORIGAM_UI_PLUGINS = import.meta.env.VITE_REACT_APP_ORIGAM_UI_PLUGINS;
Expand Down