Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(mobile): paint the window behind the iOS keyboard
Elian Dorandf07a49a0dfb
diff --git a/.claude/skills/developing-capacitor-mobile/SKILL.md b/.claude/skills/developing-capacitor-mobile/SKILL.mdindex 8aac94c874..38630a3397 100644--- a/.claude/skills/developing-capacitor-mobile/SKILL.md+++ b/.claude/skills/developing-capacitor-mobile/SKILL.md@@ -128,7 +128,7 @@ writes it into `Directory.Cache` and hands the file to the system share sheet.## Native shells- **Android `MainActivity`**: installs `TriliumRequestBridge` and sets `TriliumWebViewClient`, draws edge-to-edge with transparent system bars, forwards window insets to the WebView (so the client can pad for the status/navigation bars) and re-applies system bar appearance on configuration change. Nightly and debug builds get a distinct `applicationId` suffix (`.nightly`, `.debug`) and launcher icon so they install side by side (`android/app/build.gradle`).-- **iOS `ViewController`**: the layout is `body { position: fixed; height: 100vh }` with an inner scrolling container, so WKWebView's reflexive scroll-to-focused-element would drag the toolbar off-screen; the controller pins the outer scroll offset while the keyboard animates and samples the keyboard's top edge every frame into the `--tn-keyboard-gap` CSS variable so the editor toolbar follows an interactive swipe-dismiss. `Keyboard.resize: "native"` in the config is part of the same contract. Change the keyboard/toolbar CSS on the client and this controller together.+- **iOS `ViewController`**: the layout is `body { position: fixed; height: 100vh }` with an inner scrolling container, so WKWebView's reflexive scroll-to-focused-element would drag the toolbar off-screen; the controller pins the outer scroll offset while the keyboard animates and samples the keyboard's top edge every frame into the `--tn-keyboard-gap` CSS variable so the editor toolbar follows an interactive swipe-dismiss. `Keyboard.resize: "native"` in the config is part of the same contract. Because `native` shrinks the WebView (the controller's whole `view`) to the keyboard's top, the area behind the keyboard is the `UIWindow`, whose default background is black and shows through the keyboard's rounded corners; `Keyboard.autoBackdropColor: "dom"` makes the plugin repaint the window with `body`'s computed background on every `keyboardWillShow`. Change the keyboard/toolbar CSS on the client and this controller together.- `limitsNavigationsToAppBoundDomains: true` on iOS.## Safe-area insets: never write a bare `env(safe-area-inset-*)`diff --git a/apps/mobile/capacitor.config.json b/apps/mobile/capacitor.config.jsonindex 93840453eb..43df5737e7 100644--- a/apps/mobile/capacitor.config.json+++ b/apps/mobile/capacitor.config.json@@ -12,7 +12,8 @@},"plugins": {"Keyboard": {- "resize": "native"+ "resize": "native",+ "autoBackdropColor": "dom"}}}