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): show the settings dropdowns above the dialog
Elian Dorane119d5b2f008
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex 7bf4e354ee..78e594e57f 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -456,6 +456,13 @@ button kbd {--bs-dropdown-link-active-bg: var(--active-item-background-color) !important;}+/* A portaled menu (the Dropdown's `portalToBody`) stacks in the root context, so it has to clear a+ modal (1055) and a stacked quick-edit popup (1100), and stay under the prompts (2000) it can+ summon. */+body > .tn-dropdown-portal > .dropdown-menu {+ --bs-dropdown-zindex: 1200;+}+body.desktop .dropdown-menu,body.desktop .tabulator-popup-container,:root .excalidraw .dropdown-menu .dropdown-menu-container,diff --git a/apps/client/src/widgets/note_icon.css b/apps/client/src/widgets/note_icon.cssindex 70bf867d75..8b99fb3861 100644--- a/apps/client/src/widgets/note_icon.css+++ b/apps/client/src/widgets/note_icon.css@@ -6,14 +6,6 @@ div.note-icon-widget {contain: unset;}-/* The menu is portaled to `document.body` (see the Dropdown's `portalToBody`), so it competes with- modals in the root stacking context instead of painting inside them. The global dropdown z-index- (999) ties with the quick-edit dialog (999, or 1100 when stacked) and loses, hiding the picker.- Raise it above any modal it can be opened from. */-body > div.note-icon-widget > .dropdown-menu {- --bs-dropdown-zindex: 1200;-}-.note-icon-widget button.note-icon {--size: calc(var(--note-icon-size) + var(--note-icon-container-padding-size) * 2);diff --git a/apps/client/src/widgets/react/Dropdown.spec.tsx b/apps/client/src/widgets/react/Dropdown.spec.tsxindex 224ebcb721..61eef3dda0 100644--- a/apps/client/src/widgets/react/Dropdown.spec.tsx+++ b/apps/client/src/widgets/react/Dropdown.spec.tsx@@ -106,6 +106,9 @@ describe("Dropdown", () => {const menu = document.body.querySelector(":scope > .my-scope > .dropdown-menu");expect(menu).toBeTruthy();expect(instance._menu).toBe(menu);+ // `tn-dropdown-portal` is what style.css hangs the out-of-modal z-index on; without it a+ // portaled menu paints under whatever dialog it was opened from.+ expect(menu?.parentElement?.classList.contains("tn-dropdown-portal")).toBe(true);// Releasing focus without opening tears the empty menu back down.fire(getToggle(), "focusout");diff --git a/apps/client/src/widgets/react/Dropdown.tsx b/apps/client/src/widgets/react/Dropdown.tsxindex e80e5c8cb8..2fb7cd720e 100644--- a/apps/client/src/widgets/react/Dropdown.tsx+++ b/apps/client/src/widgets/react/Dropdown.tsx@@ -52,8 +52,9 @@ export interface DropdownProps extends Pick<HTMLProps<HTMLDivElement>, "id" | "c** Use this when an ancestor establishes a containment/backdrop root (e.g. `container-type`,* `transform`, `filter`) which would otherwise flatten the menu's `backdrop-filter` blur into a- * flat tint. The menu is wrapped in a `<div class={className}>` so any CSS scoped under that- * class keeps applying even though the menu no longer lives inside the toggle's wrapper.+ * flat tint. The menu is wrapped in a `<div class="tn-dropdown-portal {className}">` so any CSS+ * scoped under that class keeps applying even though the menu no longer lives inside the+ * toggle's wrapper, and so the menu outranks whatever stacking context it was lifted out of.*/portalToBody?: boolean;/**@@ -256,9 +257,10 @@ export default function Dropdown({ id, className, buttonClassName, isStatic, chi{portalToBody// Keep the `className` scope on the portaled wrapper so CSS scoped under it (e.g.// `.note-icon-widget .icon-list`) still applies even though the menu now lives in body.+ // `tn-dropdown-portal` beside it carries the z-index a menu needs out here (style.css).// Only mount it while needed (see `menuMounted`) so closed pickers don't each leave an// empty menu wrapper in the body.- ? (menuMounted && createPortal(<div class={className ?? ""}>{menu}</div>, document.body))+ ? (menuMounted && createPortal(<div class={`tn-dropdown-portal ${className ?? ""}`}>{menu}</div>, document.body)): menu}</div>);diff --git a/apps/client/src/widgets/react/HelpDropdown.css b/apps/client/src/widgets/react/HelpDropdown.cssindex 1ad8a23d18..dbb04abdc6 100644--- a/apps/client/src/widgets/react/HelpDropdown.css+++ b/apps/client/src/widgets/react/HelpDropdown.css@@ -3,11 +3,6 @@}.dropdown-menu.help-dropdown-content {- /* Dropdowns sit at 999, just under the popups anchored to the same widgets (e.g. the attribute- detail at 1000). Help is always an explicit, transient request, so it has to win over- whatever it was opened on top of. */- --bs-dropdown-zindex: 1001;-max-width: 340px;padding: 12px;white-space: normal;