Skip to content

Build your personal knowledge base with Trilium Notes

fix(inline_title): tooltip getting stuck if refresh

Elian Doran7a1ea8833fb4
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index 57b8309349..c5e9711d4b 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -772,6 +772,11 @@ export function useStaticTooltip(elRef: RefObject<Element>, config?: Partial<Too
// workaround for https://github.com/twbs/bootstrap/issues/37474
(tooltip as any)._activeTrigger = {};
(tooltip as any)._element = document.createElement('noscript'); // placeholder with no behavior
+
+ // Remove *all* tooltip elements from the DOM
+ document
+ .querySelectorAll('.tooltip')
+ .forEach(t => t.remove());
};
}, [ elRef, config ]);
}