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): keep the iOS home-screen app's bottom bar on screen
Elian Doran0a98878f05cd
diff --git a/apps/client/src/index.ts b/apps/client/src/index.tsindex eedd0356dd..0c9c07b555 100644--- a/apps/client/src/index.ts+++ b/apps/client/src/index.ts@@ -42,7 +42,7 @@ async function bootstrap() {reportSplashPhase("bootstrap");// Only iOS sets `navigator.standalone`, and only for a web app added to the home screen.const isIosWebApp = (navigator as Navigator & { standalone?: boolean }).standalone === true;- document.documentElement.classList.toggle("ios-web-app", isIosWebApp);+ document.documentElement.classList.toggle("ios-web-app", isIosWebApp && extendsUnderStatusBar());await setupGlob();await Promise.all([initJQuery(),@@ -61,6 +61,19 @@ async function bootstrap() {hideSplash();}+/**+ * Whether the page is drawn under the status bar, which gives it a top safe-area inset. With the+ * status bar above the page instead, there is no inset and the viewport already fits the screen.+ */+function extendsUnderStatusBar() {+ const probe = document.createElement("div");+ probe.style.cssText = "position:fixed;visibility:hidden;padding-top:env(safe-area-inset-top)";+ document.documentElement.append(probe);+ const insetTop = parseFloat(getComputedStyle(probe).paddingTop);+ probe.remove();+ return insetTop > 0;+}+async function initJQuery() {const $ = (await import("jquery")).default;window.$ = $;diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex 954a5e5d1f..033b092719 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -79,7 +79,8 @@ html {}/* iOS 26 gives a web app added to the home screen a dynamic viewport short by the status bar until- the first rotation (WebKit bug 301108); the large viewport is the screen's height from the start. */+ the first rotation (WebKit bug 301108); the large viewport is the screen's height from the start.+ `bootstrap()` sets the class only when the page runs under the status bar. */html.ios-web-app,html.ios-web-app body,html.ios-web-app #root-widget {