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(global_menu): zoom controls tooltip overlapping
Elian Doran311f4aded87a
diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsxindex 70e43887f2..39fcb88e84 100644--- a/apps/client/src/widgets/buttons/global_menu.tsx+++ b/apps/client/src/widgets/buttons/global_menu.tsx@@ -157,7 +157,10 @@ function ZoomControls({ parentComponent }: { parentComponent?: Component | nullfunction ZoomControlButton({ command, title, icon, children }: { command: KeyboardActionNames, title: string, icon?: string, children?: ComponentChildren }) {const linkRef = useRef<HTMLAnchorElement>(null);- useStaticTooltipWithKeyboardShortcut(linkRef, title, command);+ useStaticTooltipWithKeyboardShortcut(linkRef, title, command, {+ placement: "bottom",+ fallbackPlacements: [ "bottom" ]+ });return (<aref={linkRef}diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex 6a4b4ab154..6eeac81e1e 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -545,10 +545,11 @@ export function useStaticTooltip(elRef: RefObject<Element>, config?: Partial<Too}, [ elRef, config ]);}-export function useStaticTooltipWithKeyboardShortcut(elRef: RefObject<Element>, title: string, actionName: KeyboardActionNames | undefined) {+export function useStaticTooltipWithKeyboardShortcut(elRef: RefObject<Element>, title: string, actionName: KeyboardActionNames | undefined, opts?: Omit<Partial<Tooltip.Options>, "title">) {const [ keyboardShortcut, setKeyboardShortcut ] = useState<string[]>();useStaticTooltip(elRef, {- title: keyboardShortcut?.length ? `${title} (${keyboardShortcut?.join(",")})` : title+ title: keyboardShortcut?.length ? `${title} (${keyboardShortcut?.join(",")})` : title,+ ...opts});useEffect(() => {