aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/modules/fomantic.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-09-24 21:07:57 +0800
committerGitHub <noreply@github.com>2023-09-24 21:07:57 +0800
commitefd51762781d4ba57c459190846a26636aef6564 (patch)
treea256af623c9b0cf9c1ed8a066a750c07a55847c7 /web_src/js/modules/fomantic.js
parentda0467e3b658b7105fec48c71cc64be4410ffce5 (diff)
downloadgitea-efd51762781d4ba57c459190846a26636aef6564.tar.gz
gitea-efd51762781d4ba57c459190846a26636aef6564.zip
Fix Fomantic UI dropdown icon bug when there is a search input in menu (#27225)
Fix #27224 And add the case to the devtest page.
Diffstat (limited to 'web_src/js/modules/fomantic.js')
-rw-r--r--web_src/js/modules/fomantic.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/web_src/js/modules/fomantic.js b/web_src/js/modules/fomantic.js
index ab5f842bc6..3d4a66c1ea 100644
--- a/web_src/js/modules/fomantic.js
+++ b/web_src/js/modules/fomantic.js
@@ -16,6 +16,9 @@ export function initGiteaFomantic() {
$.fn.dropdown.settings.fullTextSearch = 'exact';
// Do not use "cursor: pointer" for dropdown labels
$.fn.dropdown.settings.className.label += ' gt-cursor-default';
+ // The default selector has a bug: if there is a "search input" in the "menu", Fomantic will only "focus the input" but not "toggle the menu" when the "dropdown icon" is clicked.
+ // Actually, the "search input in menu" shouldn't be considered as the dropdown's input
+ $.fn.dropdown.settings.selector.search = '> input.search, :not(.menu) > .search > input, :not(.menu) input.search';
// Always use Gitea's SVG icons
$.fn.dropdown.settings.templates.label = function(_value, text, preserveHTML, className) {
const escape = $.fn.dropdown.settings.templates.escape;