From 8678ebc5199669c8d4a5c6830b004f1db24d9d86 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 15 Aug 2019 10:59:10 +0530 Subject: [PATCH] fix: Duplicate items in menu dropdown --- frappe/public/js/frappe/ui/page.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/ui/page.js b/frappe/public/js/frappe/ui/page.js index 0d3d025ddd..b7033ca3b4 100644 --- a/frappe/public/js/frappe/ui/page.js +++ b/frappe/public/js/frappe/ui/page.js @@ -380,14 +380,16 @@ frappe.ui.Page = Class.extend({ * @param {string} selector - CSS Selector of the button to be searched for. By default, it is `li`. * @param {string} label - Label of the button */ - is_in_group_button_dropdown: function(parent, selector, label){ + is_in_group_button_dropdown: function(parent, selector, label) { + if (!selector) selector = 'li'; if (!label || !parent) return false; const result = $(parent).find(`${selector}:contains('${label}')`) .filter(function() { - return $(this).text() === label; + let item = $(this).html(); + return $(item).attr('data-label') === label; }); return result.length > 0; },