Skip to content

Build your personal knowledge base with Trilium Notes

style/right pane toggle handle: tweak

Adorian Doran0cb0d60524b5
diff --git a/apps/client/src/widgets/sidebar/RightPaneToggleHandle.css b/apps/client/src/widgets/sidebar/RightPaneToggleHandle.css
index 5b877b97e6..dcbb3c2469 100644
--- a/apps/client/src/widgets/sidebar/RightPaneToggleHandle.css
+++ b/apps/client/src/widgets/sidebar/RightPaneToggleHandle.css
@@ -20,6 +20,7 @@
font-size: 16px;
cursor: pointer;
color: var(--muted-text-color);
+ transition: background 250ms ease-in, color 250ms ease-in;
&.right-pane-toggle-handle-action-expand {
background: var(--note-split-background-color, var(--main-background-color));
@@ -31,5 +32,7 @@
&:hover {
background-color: var(--hover-item-background-color);
+ color: var(--hover-item-text-color);
+ transition: initial;
}
}
diff --git a/apps/client/src/widgets/sidebar/RightPaneToggleHandle.tsx b/apps/client/src/widgets/sidebar/RightPaneToggleHandle.tsx
index a0518a1cfb..83d39ef5eb 100644
--- a/apps/client/src/widgets/sidebar/RightPaneToggleHandle.tsx
+++ b/apps/client/src/widgets/sidebar/RightPaneToggleHandle.tsx
@@ -9,6 +9,9 @@ import { t } from "../../services/i18n";
import options from "../../services/options";
import { useStaticTooltip, useTriliumEvent } from "../react/hooks";
+// Gap (px) between the handle and its tooltip, so the tooltip can't overlap the handle.
+const TOOLTIP_MARGIN_PX = 8;
+
export default function RightPaneToggleHandle() {
const buttonRef = useRef<HTMLButtonElement>(null);
// Pointer's vertical position captured once on hover; null until the mouse enters
@@ -35,13 +38,15 @@ export default function RightPaneToggleHandle() {
// Anchor the tooltip to the pointer's entry height rather than the centre of the
// full-height handle, by shifting it along the cross axis. Not tracked: `pointerY`
// is only updated on mouse enter, and the offset is recomputed from it on show.
+ // The `distance` (second value) keeps the tooltip clear of the handle so it can't
+ // overlap it and cause hover flicker.
const tooltipConfig = useMemo(() => ({
title: t("right_pane.toggle"),
placement: "left" as const,
offset: () => {
const rect = buttonRef.current?.getBoundingClientRect();
- if (!rect || pointerY.current === null) return [ 0, 0 ] as [number, number];
- return [ pointerY.current - (rect.top + rect.height / 2), 0 ] as [number, number];
+ if (!rect || pointerY.current === null) return [ 0, TOOLTIP_MARGIN_PX ] as [number, number];
+ return [ pointerY.current - (rect.top + rect.height / 2), TOOLTIP_MARGIN_PX ] as [number, number];
}
}), []);
useStaticTooltip(buttonRef, tooltipConfig);
diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.css b/apps/client/src/widgets/sidebar/RightPanelContainer.css
index 7957cec05a..cfaa60a570 100644
--- a/apps/client/src/widgets/sidebar/RightPanelContainer.css
+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.css
@@ -6,7 +6,7 @@ body.experimental-feature-new-layout #vertical-main-container {
--right-pane-handle-width: 12px;
position: relative;
/* +2px leaves a small gap between the panel (and #center-pane) and the handle. */
- padding-inline-end: calc(var(--right-pane-handle-width) + 2px);
+ padding-inline-end: calc(var(--right-pane-handle-width) + 4px);
}
body.experimental-feature-new-layout #right-pane {