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(tooltips): give the tooltip layer its own number, above the dialogs
Elian Doran50c5991328df
diff --git a/apps/client/src/stylesheets/ckeditor-theme.css b/apps/client/src/stylesheets/ckeditor-theme.cssindex 622454bbef..7a281d7732 100644--- a/apps/client/src/stylesheets/ckeditor-theme.css+++ b/apps/client/src/stylesheets/ckeditor-theme.css@@ -106,8 +106,6 @@ body {--ck-color-engine-placeholder-text: var(--muted-text-color);- --ck-z-modal: 10000;---ck-color-widget-type-around-button: var(--main-border-color);--ck-color-widget-type-around-button-hover: var(--main-border-color);}diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex ca775bb272..39e1d217a1 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -782,26 +782,29 @@ table.promoted-attributes-in-tooltip th {.tooltip {font-size: var(--main-font-size) !important;- /* Just under CKEditor's panels (balloons, dropdowns), so a tooltip on an editor button doesn't- cover the panel that button opens.+ /* Above every layer the app opens over the page: a tooltip is appended to `<body>`, so it+ competes with a dialog in the root stacking context rather than painting inside it, and any+ lower layer leaves it unreadable behind the very dialog it was asked for. Bootstrap's modal+ sits at 1055, the dialogs the app lifts itself at up to 3000, the context menu at 2500.- The fallback is not decoration: `--ck-z-panel` is declared by CKEditor's own stylesheet, which- only enters the document with the lazily loaded editor bundle. Until something pulls it in- (a text note, the attribute editor), the variable is undefined, `calc()` is invalid at- computed-value time and the whole declaration — `!important` and all — resolves to the initial- `z-index: auto`. Tooltips then paint below every positioned layer with a z-index of its own,- the peeked right pane among them (they show up blurred through its backdrop-filter). The- fallback matches what CKEditor declares, so the value doesn't shift once the bundle loads. */- z-index: calc(var(--ck-z-panel, 1000) - 1) !important;+ This layer used to be chained to CKEditor's own — `calc(var(--ck-z-panel) - 1)` — which+ `ckeditor-theme.css` raised to 10000 for exactly this reason, landing tooltips at 9999.+ Upstream renamed the variable (`--ck-z-modal` → `--ck-z-panel`) and the override went dead+ with the old name, dropping tooltips to 999 — under every dialog. Nothing showed it because+ the math form's rescue rule named a bare `[role="tooltip"]`, lifting every tooltip in the app+ to 3000; keeping that rule to MathLive's own UI is what finally uncovered it. Stated here in+ full, and no longer read from a variable another package owns. */+ z-index: 9999 !important;}.tooltip.tooltip-top {z-index: 32767 !important;}-/* Note tooltips are appended to <body> and are frequently triggered from inside modals- (e.g. links or deleted-note entries in a dialog). The base .tooltip z-index sits below- Bootstrap's modal, so raise them above it — matching .tooltip-top. */+/* Note tooltips are appended to <body> and are frequently triggered from inside a dialog (a link,+ a deleted-note entry), including the few that lift themselves above the base tooltip layer — the+ content manager's active-content overlay among them. Held at the same "above everything" layer+ .tooltip-top names, so they clear those too. */.tooltip.note-tooltip {z-index: 32767 !important;}diff --git a/apps/client/src/widgets/react/ContextualHelp.tsx b/apps/client/src/widgets/react/ContextualHelp.tsxindex 1bf4f3cb00..27d77339dd 100644--- a/apps/client/src/widgets/react/ContextualHelp.tsx+++ b/apps/client/src/widgets/react/ContextualHelp.tsx@@ -40,9 +40,9 @@ function HoveredHelp({ helpMessage }: ContextualHelpProps) {useStaticTooltip(ref, useMemo(() => ({title: helpMessage,placement: "bottom" as const,- // Bootstrap appends tooltips to `<body>`, where the base `.tooltip` z-index sits below a- // modal — and these icons are often shown inside the settings dialog, so without this the- // hint would open behind the dialog that triggered it.+ // These icons are often shown inside the settings dialog, and the dialog's own overlays+ // (the content manager's, say) lift themselves above the base tooltip layer. `tooltip-top`+ // is the app's "above everything" layer, so the hint clears those too.customClass: "tooltip-top"}), [ helpMessage ]));diff --git a/apps/client/src/widgets/react/charts/chart_tooltip.tsx b/apps/client/src/widgets/react/charts/chart_tooltip.tsxindex 400b1bcd69..da9f211787 100644--- a/apps/client/src/widgets/react/charts/chart_tooltip.tsx+++ b/apps/client/src/widgets/react/charts/chart_tooltip.tsx@@ -49,9 +49,10 @@ export function useChartTooltip<T extends HTMLElement>() {tooltipNode: tooltip && (// The `tooltip show` classes matter: the themes set the colours on `.tooltip` and scope// the text colour to `.tooltip .tooltip-inner`, so a bare inner would inherit the page's.- // `tooltip-top` is the app's "raise above everything" class: the base `.tooltip` z-index- // is derived from a CKEditor variable that is out of scope here, leaving the bubble at- // `auto` — under the hovered mark, which lifts itself to draw its outline.+ // `tooltip-top` is the app's "raise above everything" class. Unlike a Bootstrap tooltip,+ // this bubble is rendered inside the chart rather than appended to `<body>`, so it is+ // stacked against the chart's own marks — and the hovered one lifts itself to draw its+ // outline, which the base tooltip layer would not clear.<divclassName={clsx("tooltip", "show", "tooltip-top", "chart-tooltip",diff --git a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsxindex 39ad09fe56..7848d9459e 100644--- a/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx+++ b/apps/client/src/widgets/type_widgets/options/content_manager/space_usage/index.tsx@@ -128,8 +128,8 @@ export default function SpaceUsage({ sectionSwitcher }: ContentManagerSectionPro*/function StatusEntry({ text, hint }: { text: string, hint: string }) {const ref = useRef<HTMLSpanElement>(null);- // `tooltip-top` raises the popup above the settings dialog: Bootstrap appends tooltips to- // `<body>`, where the base `.tooltip` z-index sits below a modal.+ // `tooltip-top` is the app's "above everything" layer, which the status line needs: the content+ // manager's own active-content overlay stands above the base tooltip layer.useStaticTooltip(ref, useMemo(() => ({ title: hint, placement: "top", customClass: "tooltip-top" }),[ hint ]