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(options/backup): show the password dialog above its backdrop
Elian Doran2e342b75defa
diff --git a/apps/client/src/widgets/type_widgets/options/backup.options.spec.tsx b/apps/client/src/widgets/type_widgets/options/backup.options.spec.tsxindex 4a6c6aeec8..aaf8fdd232 100644--- a/apps/client/src/widgets/type_widgets/options/backup.options.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/backup.options.spec.tsx@@ -95,6 +95,15 @@ describe("what the encryption controls offer", () => {expect(host.querySelector("input.switch-toggle[id^='backup-compression']")).not.toBeNull();});+ it("mounts the password dialog on the body, beside Bootstrap's backdrop", async () => {+ await open();++ const modal = document.querySelector(".backup-password-modal");+ expect(modal).not.toBeNull();+ expect(host.contains(modal)).toBe(false);+ expect(modal?.parentElement).toBe(document.body);+ });+it("offers to replace the passphrase, and a switch, once one is held", async () => {mocks.passphrase = { available: true, set: true };await open();diff --git a/apps/client/src/widgets/type_widgets/options/backup.tsx b/apps/client/src/widgets/type_widgets/options/backup.tsxindex 75c8d693fe..960e2349c0 100644--- a/apps/client/src/widgets/type_widgets/options/backup.tsx+++ b/apps/client/src/widgets/type_widgets/options/backup.tsx@@ -6,6 +6,7 @@ import {DatabaseBackup,ExistingBackupsResponse} from "@triliumnext/commons";+import { createPortal } from "preact";import { useCallback, useEffect, useRef, useState } from "preact/hooks";import { isBackupDownloadSupported } from "../../../services/backup_download";@@ -451,11 +452,14 @@ export function BackupOptions() {</OptionCardSection></Card>- <BackupPasswordModal- show={passwordModalShown}- onHidden={() => setPasswordModalShown(false)}- onSave={storePassword}- />+ {createPortal(+ <BackupPasswordModal+ show={passwordModalShown}+ onHidden={() => setPasswordModalShown(false)}+ onSave={storePassword}+ />,+ document.body+ )}</>);}