Skip to content

Commit 6d23382

Browse files
committed
close app menu when mouse leaves it
1 parent dc0d4b5 commit 6d23382

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/components/BorderedApp/BorderedAppMenu/BorderedAppMenu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ function BorderedAppMenuItem({
5353
if (hoverRevealDelayRef.current) {
5454
clearTimeout(hoverRevealDelayRef.current);
5555
}
56+
if (open) {
57+
hoverRevealDelayRef.current = setTimeout(() => {
58+
if (open) setOpen(false);
59+
});
60+
}
5661
}
5762

5863
function handleOnClick(e: React.MouseEvent<HTMLDivElement>) {
@@ -119,7 +124,6 @@ function BorderedAppMenu({ title, items }: BorderedAppMenuProps) {
119124
const [open, setOpen] = useState<boolean>(false);
120125
const elementRef = useRef<HTMLDivElement>(null);
121126
const position = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
122-
const settings = useSystemSettings();
123127

124128
useEffect(() => {
125129
const rect = elementRef.current?.getBoundingClientRect();

0 commit comments

Comments
 (0)