Android task entry fix

This commit is contained in:
2026-03-29 11:49:42 -04:00
parent 586497e1fa
commit a87964d2ed
2 changed files with 15 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,13 @@ export class TaskEditorModal extends Modal {
// on window with an explicit keyboardHeight so we use those as the primary // on window with an explicit keyboardHeight so we use those as the primary
// signal, with a visualViewport fallback for other environments. // signal, with a visualViewport fallback for other environments.
// keyboardVisible tracks whether a Capacitor event has told us the
// keyboard is open. The visualViewport fallback checks this flag so it
// never resets a layout that Capacitor already applied.
let keyboardVisible = false;
const applyLayout = (keyboardHeight: number) => { const applyLayout = (keyboardHeight: number) => {
keyboardVisible = true;
const available = window.innerHeight - keyboardHeight; const available = window.innerHeight - keyboardHeight;
this.containerEl.style.height = `${available}px`; this.containerEl.style.height = `${available}px`;
this.containerEl.style.alignItems = 'flex-start'; this.containerEl.style.alignItems = 'flex-start';
@ -61,6 +67,7 @@ export class TaskEditorModal extends Modal {
this.modalEl.style.maxHeight = `${available - 16}px`; this.modalEl.style.maxHeight = `${available - 16}px`;
}; };
const resetLayout = () => { const resetLayout = () => {
keyboardVisible = false;
this.containerEl.style.height = ''; this.containerEl.style.height = '';
this.containerEl.style.alignItems = ''; this.containerEl.style.alignItems = '';
this.containerEl.style.paddingTop = ''; this.containerEl.style.paddingTop = '';
@ -77,7 +84,10 @@ export class TaskEditorModal extends Modal {
const onCapacitorHide = () => resetLayout(); const onCapacitorHide = () => resetLayout();
// visualViewport fallback: works when adjustResize / adjustPan is active. // visualViewport fallback: works when adjustResize / adjustPan is active.
// Skips the reset branch if Capacitor has already applied a layout, so it
// doesn't undo the Capacitor-driven adjustment.
const onViewport = () => { const onViewport = () => {
if (keyboardVisible) return;
const vv = window.visualViewport; const vv = window.visualViewport;
if (!vv) return; if (!vv) return;
const kh = Math.max(0, window.innerHeight - vv.height - vv.offsetTop); const kh = Math.max(0, window.innerHeight - vv.height - vv.offsetTop);