Skip to content

Build your personal knowledge base with Trilium Notes

feat(mobile): offer backdrop effects on iOS

Elian Doran7c317acdfbc6
diff --git a/apps/client/src/widgets/containers/root_container.spec.ts b/apps/client/src/widgets/containers/root_container.spec.ts
index 71a7a92a88..7d232f6ad9 100644
--- a/apps/client/src/widgets/containers/root_container.spec.ts
+++ b/apps/client/src/widgets/containers/root_container.spec.ts
@@ -116,4 +116,21 @@ describe("RootContainer", () => {
rootContainer.entitiesReloadedEvent({ loadResults });
expect(isMarked()).toBe(true);
});
+
+ it("keeps backdrop effects on a mobile device only on iOS", () => {
+ const isDisabled = () => document.body.classList.contains("backdrop-effects-disabled");
+ const userAgent = vi.spyOn(navigator, "userAgent", "get");
+ options.set("backdropEffectsEnabled", "true");
+
+ userAgent.mockReturnValue("Mozilla/5.0 (iPhone; CPU iPhone OS 26_0 like Mac OS X) Mobile");
+ new RootContainer(false).render();
+ expect(isDisabled()).toBe(false);
+
+ userAgent.mockReturnValue("Mozilla/5.0 (Linux; Android 15; Pixel 9) Mobile");
+ new RootContainer(false).render();
+ expect(isDisabled()).toBe(true);
+
+ userAgent.mockRestore();
+ document.body.classList.remove("backdrop-effects-disabled", "ios");
+ });
});
diff --git a/apps/client/src/widgets/containers/root_container.ts b/apps/client/src/widgets/containers/root_container.ts
index 05263d210c..82f2a44367 100644
--- a/apps/client/src/widgets/containers/root_container.ts
+++ b/apps/client/src/widgets/containers/root_container.ts
@@ -195,7 +195,7 @@ export default class RootContainer extends FlexContainer<BasicWidget> {
}
#setBackdropEffects() {
- const enabled = options.is("backdropEffectsEnabled") && !isMobile();
+ const enabled = options.is("backdropEffectsEnabled") && (!isMobile() || isIOS());
document.body.classList.toggle("backdrop-effects-disabled", !enabled);
}
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 13ec25c66f..d0ed9e361c 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -5,7 +5,7 @@ import { useMemo } from "preact/hooks";
import zoomService from "../../../components/zoom";
import { ColorScheme, resolveColorScheme, THEME_FAMILY_SCHEMES } from "../../../services/color_scheme";
import { t } from "../../../services/i18n";
-import { isElectron, isMobile } from "../../../services/utils";
+import { isElectron, isIOS, isMobile } from "../../../services/utils";
import { Card, CardSection, OptionCardSection } from "../../react/Card";
import Dropdown from "../../react/Dropdown";
import { FormListHeader, FormListItem } from "../../react/FormList";
@@ -313,7 +313,7 @@ function Performance() {
<FormToggle currentValue={shadowsEnabled} onChange={setShadowsEnabled} />
</OptionCardSection>
- {!isMobile() && (
+ {(!isMobile() || isIOS()) && (
<OptionCardSection name="backdrop-effects-enabled" label={t("ui-performance.enable-backdrop-effects")}>
<FormToggle currentValue={backdropEffectsEnabled} onChange={setBackdropEffectsEnabled} />
</OptionCardSection>