Skip to content

Build your personal knowledge base with Trilium Notes

style/context menus: fix submenu position when is near to the bottom of the screen

Adorian Doran998f6b1e27db
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 15f3806988..9d7a6613e2 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1593,6 +1593,14 @@ body.desktop li.dropdown-submenu:hover > ul.dropdown-menu {
overflow: auto;
}
+/* Flipped upward (added by ContextMenu.repositionSubmenu) when the submenu would overflow the bottom of the viewport. */
+.dropdown-submenu > .dropdown-menu.submenu-flip-up {
+ top: auto;
+ bottom: 0;
+ margin-top: 0;
+ margin-bottom: -10px;
+}
+
body.desktop .dropdown-submenu > .dropdown-menu {
min-width: max-content;
max-width: 300px;
diff --git a/apps/client/src/widgets/buttons/left_pane_toggle.tsx b/apps/client/src/widgets/buttons/left_pane_toggle.tsx
index 106c4be004..f22c9956ae 100644
--- a/apps/client/src/widgets/buttons/left_pane_toggle.tsx
+++ b/apps/client/src/widgets/buttons/left_pane_toggle.tsx
@@ -3,6 +3,7 @@ import { useEffect, useState } from "preact/hooks";
import ActionButton from "../react/ActionButton";
import options from "../../services/options";
import { t } from "../../services/i18n";
+import { showLaunchBarManagementContextMenu } from "../../menus/launcher_button_context_menu";
import { useTriliumEvent } from "../react/hooks";
import resizer from "../../services/resizer";
@@ -23,6 +24,7 @@ export default function LeftPaneToggle({ isHorizontalLayout }: { isHorizontalLay
text={currentLeftPaneVisible ? t("left_pane_toggle.hide_panel") : t("left_pane_toggle.show_panel")}
triggerCommand={currentLeftPaneVisible ? "hideLeftPane" : "showLeftPane"}
icon={isHorizontalLayout ? "bx bx-sidebar" : "bx bx-chevrons-left"}
+ onContextMenu={showLaunchBarManagementContextMenu}
/>
)
}
\ No newline at end of file