From af7e5382ad913f6d8d6e48e60bc304d57c10e71b Mon Sep 17 00:00:00 2001 From: leonace924 Date: Wed, 7 Jan 2026 10:04:18 -0500 Subject: [PATCH 1/2] fix: wrong tag added after enter --- frappe/public/js/frappe/ui/tag_editor.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/ui/tag_editor.js b/frappe/public/js/frappe/ui/tag_editor.js index 7fb42caa51..856451a216 100644 --- a/frappe/public/js/frappe/ui/tag_editor.js +++ b/frappe/public/js/frappe/ui/tag_editor.js @@ -101,6 +101,13 @@ frappe.ui.TagEditor = class TagEditor { }); $input.on("enter-pressed-in-addtag", function (e) { var value = e.target.value; + // If user typed something, use exactly what they typed + // Don't override with suggestions - let user create new tags + if (value && value.trim()) { + $input.trigger("input-selected"); + return; + } + // Only fetch suggestions if input is empty frappe.call({ method: "frappe.desk.doctype.tag.tag.get_tags", args: { @@ -108,8 +115,9 @@ frappe.ui.TagEditor = class TagEditor { txt: value.toLowerCase(), }, callback: function (r) { - // Updates input to suggestion value (if any) on - if (r.message.length) $input.val(r.message[0]); + if (r.message.length) { + $input.val(r.message[0]); + } $input.trigger("input-selected"); }, }); From e8937cb3f8d2a2afd076100ee6c4513752f2df1f Mon Sep 17 00:00:00 2001 From: leonace924 Date: Wed, 7 Jan 2026 10:23:41 -0500 Subject: [PATCH 2/2] fix: revert old code --- frappe/public/js/frappe/ui/tag_editor.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/ui/tag_editor.js b/frappe/public/js/frappe/ui/tag_editor.js index 856451a216..391a336820 100644 --- a/frappe/public/js/frappe/ui/tag_editor.js +++ b/frappe/public/js/frappe/ui/tag_editor.js @@ -115,9 +115,8 @@ frappe.ui.TagEditor = class TagEditor { txt: value.toLowerCase(), }, callback: function (r) { - if (r.message.length) { - $input.val(r.message[0]); - } + // Updates input to suggestion value (if any) on + if (r.message.length) $input.val(r.message[0]); $input.trigger("input-selected"); }, });