Skip to content

Build your personal knowledge base with Trilium Notes

fix(mobile): tree not closing after pressing menu item

Elian Dorana8f1abb77f5a
diff --git a/docs/Release Notes/Release Notes/v0.92.8-beta.md b/docs/Release Notes/Release Notes/v0.92.8-beta.md
index c26862c735..d1723ba17a 100644
--- a/docs/Release Notes/Release Notes/v0.92.8-beta.md
+++ b/docs/Release Notes/Release Notes/v0.92.8-beta.md
@@ -6,7 +6,9 @@
## 🐞 Bugfixes
* Calendar does not hide when clicking on a note by @JYC333
-* [Unable to add internal link on mobile version](https://github.com/TriliumNext/Notes/issues/1677)
+* Mobile improvements:
+ * [Unable to add internal link on mobile version](https://github.com/TriliumNext/Notes/issues/1677)
+ * Note tree not closing when selecting some of the menu actions.
## ✨ Improvements
diff --git a/src/public/app/menus/tree_context_menu.ts b/src/public/app/menus/tree_context_menu.ts
index 4cc094e0bd..309b533225 100644
--- a/src/public/app/menus/tree_context_menu.ts
+++ b/src/public/app/menus/tree_context_menu.ts
@@ -12,6 +12,7 @@ import { t } from "../services/i18n.js";
import type NoteTreeWidget from "../widgets/note_tree.js";
import type FAttachment from "../entities/fattachment.js";
import type { SelectMenuItemEventListener } from "../components/events.js";
+import utils from "../services/utils.js";
// TODO: Deduplicate once client/server is well split.
interface ConvertToAttachmentResponse {
@@ -204,6 +205,10 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
async selectMenuItemHandler({ command, type, templateNoteId }: MenuCommandItem<TreeCommandNames>) {
const notePath = treeService.getNotePath(this.node);
+ if (utils.isMobile()) {
+ this.treeWidget.triggerCommand("setActiveScreen", { screen: "detail" });
+ }
+
if (command === "openInTab") {
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
} else if (command === "insertNoteAfter") {