From d385c4b87af632cf6dc44c06988d11ac1e8504a6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 16 Oct 2025 03:04:13 +0000 Subject: [PATCH 1/3] Fix: Remove focus from block after node creation Co-authored-by: mclicks --- apps/roam/src/components/CreateNodeDialog.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/roam/src/components/CreateNodeDialog.tsx b/apps/roam/src/components/CreateNodeDialog.tsx index 4211f7c56..5e5de6d4e 100644 --- a/apps/roam/src/components/CreateNodeDialog.tsx +++ b/apps/roam/src/components/CreateNodeDialog.tsx @@ -116,6 +116,11 @@ const CreateNodeDialog = ({ ), }); setLoading(false); + + // Remove focus from the block by simulating a click on the document + // This changes the UI from block editing to not block editing + document.body.click(); + onClose(); }; From 578c833beaadedf00ffedc08fa828d1c9e6e35c1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 16 Oct 2025 03:24:49 +0000 Subject: [PATCH 2/3] Refactor: Remove document click from CreateNodeDialog, add to DiscourseNodeMenu Co-authored-by: mclicks --- apps/roam/src/components/CreateNodeDialog.tsx | 5 ----- apps/roam/src/components/DiscourseNodeMenu.tsx | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/roam/src/components/CreateNodeDialog.tsx b/apps/roam/src/components/CreateNodeDialog.tsx index 5e5de6d4e..4211f7c56 100644 --- a/apps/roam/src/components/CreateNodeDialog.tsx +++ b/apps/roam/src/components/CreateNodeDialog.tsx @@ -116,11 +116,6 @@ const CreateNodeDialog = ({ ), }); setLoading(false); - - // Remove focus from the block by simulating a click on the document - // This changes the UI from block editing to not block editing - document.body.click(); - onClose(); }; diff --git a/apps/roam/src/components/DiscourseNodeMenu.tsx b/apps/roam/src/components/DiscourseNodeMenu.tsx index 2daad1186..81e081bc5 100644 --- a/apps/roam/src/components/DiscourseNodeMenu.tsx +++ b/apps/roam/src/components/DiscourseNodeMenu.tsx @@ -113,6 +113,10 @@ const NodeMenu = ({ const tag = menuItem.getAttribute("data-tag") || ""; if (!tag) return; + // Remove focus from the block to ensure updateBlock works properly + // This changes the UI from block editing to not block editing + document.body.click(); + const addTagToBlock = () => { const currentText = textarea.value; const cursorPos = textarea.selectionStart; From 6d932474aaf8e83c883bfc385b949e942201b383 Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Wed, 15 Oct 2025 23:49:57 -0600 Subject: [PATCH 3/3] move to end, add comment --- apps/roam/src/components/DiscourseNodeMenu.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/roam/src/components/DiscourseNodeMenu.tsx b/apps/roam/src/components/DiscourseNodeMenu.tsx index 81e081bc5..f49081fcd 100644 --- a/apps/roam/src/components/DiscourseNodeMenu.tsx +++ b/apps/roam/src/components/DiscourseNodeMenu.tsx @@ -113,10 +113,6 @@ const NodeMenu = ({ const tag = menuItem.getAttribute("data-tag") || ""; if (!tag) return; - // Remove focus from the block to ensure updateBlock works properly - // This changes the UI from block editing to not block editing - document.body.click(); - const addTagToBlock = () => { const currentText = textarea.value; const cursorPos = textarea.selectionStart; @@ -134,6 +130,9 @@ const NodeMenu = ({ }; // timeout required to ensure the block is updated setTimeout(() => void addTagToBlock(), 100); + + // Remove focus from the block so user can see tag css immediately + document.body.click(); } onClose(); },