Skip to content

Build your personal knowledge base with Trilium Notes

fix(context menu): not auto-closing on mobile

SiriusXT45977efd5fd1
diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts
index a8a37f4620..72519233aa 100644
--- a/apps/client/src/menus/context_menu.ts
+++ b/apps/client/src/menus/context_menu.ts
@@ -194,14 +194,15 @@ class ContextMenu {
return false;
});
- if (!this.isMobile) {
- $item.on("mouseup", (e) =>{
+ $item.on("mouseup", (e) => {
+ // Prevent submenu from failing to expand on mobile
+ if (!this.isMobile || !("items" in item && item.items)) {
e.stopPropagation();
// Hide the content menu on mouse up to prevent the mouse event from propagating to the elements below.
this.hide();
return false;
- });
- }
+ }
+ });
if ("enabled" in item && item.enabled !== undefined && !item.enabled) {
$item.addClass("disabled");
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 2f026ab014..a5f4b6bd1c 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -391,7 +391,7 @@ body.desktop .dropdown-menu {
}
body.desktop .dropdown-menu:not(#context-menu-container) .dropdown-item,
-body.desktop #context-menu-container .dropdown-item > span {
+body #context-menu-container .dropdown-item > span {
display: flex;
align-items: center;
}