mirror of
https://github.com/zadam/trilium.git
synced 2026-02-28 09:33:38 +01:00
fix(mobile): virtual keyboard detection not working on Android
This commit is contained in:
parent
df4fa42acd
commit
ae9827c436
@ -1,7 +1,6 @@
|
||||
import "./NoteDetail.css";
|
||||
|
||||
import clsx from "clsx";
|
||||
import { note } from "mermaid/dist/rendering-util/rendering-elements/shapes/note.js";
|
||||
import { isValidElement, VNode } from "preact";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
|
||||
|
||||
@ -19,9 +19,12 @@ import FlexContainer from "./flex_container.js";
|
||||
*/
|
||||
export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
|
||||
private originalWindowHeight: number;
|
||||
|
||||
constructor(isHorizontalLayout: boolean) {
|
||||
super(isHorizontalLayout ? "column" : "row");
|
||||
|
||||
this.originalWindowHeight = window.innerHeight ?? 0;
|
||||
this.id("root-widget");
|
||||
this.css("height", "100dvh");
|
||||
}
|
||||
@ -65,7 +68,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
|
||||
|
||||
#onMobileResize() {
|
||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
||||
const windowHeight = window.innerHeight;
|
||||
const windowHeight = Math.max(window.innerHeight, this.originalWindowHeight); // inner height changes when keyboard is opened, we need to compare with the original height to detect it.
|
||||
|
||||
// If viewport is significantly smaller, keyboard is likely open
|
||||
const isKeyboardOpened = windowHeight - viewportHeight > 150;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user