From 6bd2bbe312f20e5cd9fb81c21d689f5909448f05 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 29 Mar 2024 19:25:39 +0000 Subject: [PATCH 1/4] Remove jQuery class from the comment context menu - Switched from jQuery class functions to plain JavaScript `classList` - Tested the comment context menu functionality and it works as before Signed-off-by: Yarden Shoham --- web_src/js/modules/fomantic/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/modules/fomantic/dropdown.js b/web_src/js/modules/fomantic/dropdown.js index e795e8e2c8f0c..84222dd329c59 100644 --- a/web_src/js/modules/fomantic/dropdown.js +++ b/web_src/js/modules/fomantic/dropdown.js @@ -207,7 +207,7 @@ function attachDomEvents(dropdown, focusable, menu) { if (!$item) $item = $(menu).find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item // if the selected item is clickable, then trigger the click event. // we can not click any item without check, because Fomantic code might also handle the Enter event. that would result in double click. - if ($item && ($item[0].matches('a') || $item.hasClass('js-aria-clickable'))) $item[0].click(); + if ($item && ($item[0].matches('a') || $item[0].classList.contains('js-aria-clickable'))) $item[0].click(); } }); From cef62a9f55b0ab93f5e975baa1c17b49096ce150 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 29 Mar 2024 23:17:51 +0300 Subject: [PATCH 2/4] Update web_src/js/modules/fomantic/dropdown.js Co-authored-by: silverwind --- web_src/js/modules/fomantic/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/modules/fomantic/dropdown.js b/web_src/js/modules/fomantic/dropdown.js index 84222dd329c59..518602f94b0f3 100644 --- a/web_src/js/modules/fomantic/dropdown.js +++ b/web_src/js/modules/fomantic/dropdown.js @@ -207,7 +207,7 @@ function attachDomEvents(dropdown, focusable, menu) { if (!$item) $item = $(menu).find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item // if the selected item is clickable, then trigger the click event. // we can not click any item without check, because Fomantic code might also handle the Enter event. that would result in double click. - if ($item && ($item[0].matches('a') || $item[0].classList.contains('js-aria-clickable'))) $item[0].click(); + if ($item?.[0]?.matches('a.js-aria-clickable')) $item[0].click(); } }); From 07c3d1eff6efcd1f381754a49d682ad29aaa6bf0 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 29 Mar 2024 20:22:25 +0000 Subject: [PATCH 3/4] Fix --- web_src/js/modules/fomantic/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/modules/fomantic/dropdown.js b/web_src/js/modules/fomantic/dropdown.js index 518602f94b0f3..db88fc9300db6 100644 --- a/web_src/js/modules/fomantic/dropdown.js +++ b/web_src/js/modules/fomantic/dropdown.js @@ -207,7 +207,7 @@ function attachDomEvents(dropdown, focusable, menu) { if (!$item) $item = $(menu).find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item // if the selected item is clickable, then trigger the click event. // we can not click any item without check, because Fomantic code might also handle the Enter event. that would result in double click. - if ($item?.[0]?.matches('a.js-aria-clickable')) $item[0].click(); + if ($item[0].matches('a, .js-aria-clickable')) $item[0].click(); } }); From 98b72481891f5cab09c8a7ee156ffe6ffbec90be Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 29 Mar 2024 20:23:52 +0000 Subject: [PATCH 4/4] Add ? --- web_src/js/modules/fomantic/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/modules/fomantic/dropdown.js b/web_src/js/modules/fomantic/dropdown.js index db88fc9300db6..82e710860dffe 100644 --- a/web_src/js/modules/fomantic/dropdown.js +++ b/web_src/js/modules/fomantic/dropdown.js @@ -207,7 +207,7 @@ function attachDomEvents(dropdown, focusable, menu) { if (!$item) $item = $(menu).find('> .item.selected'); // when dropdown filters items by input, there is no "value", so query the "selected" item // if the selected item is clickable, then trigger the click event. // we can not click any item without check, because Fomantic code might also handle the Enter event. that would result in double click. - if ($item[0].matches('a, .js-aria-clickable')) $item[0].click(); + if ($item?.[0]?.matches('a, .js-aria-clickable')) $item[0].click(); } });