Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

ui: fix submenu positioning (#7632)

01zulfid7fdaf6c46f0
diff --git a/packages/ui/src/utils/position.ts b/packages/ui/src/utils/position.ts
index 29ed9a216..f072e37e6 100644
--- a/packages/ui/src/utils/position.ts
+++ b/packages/ui/src/utils/position.ts
@@ -92,7 +92,10 @@ export function getPosition(
} else if (location === "left") position.left -= elementWidth;
if (actualY + elementHeight > windowHeight) {
- position.top = windowHeight - elementHeight;
+ position.top =
+ target === "mouse"
+ ? windowHeight - elementHeight
+ : windowHeight - elementHeight - actualY + y;
} else {
position.top = y;
}