summaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-09-24 21:42:00 +0800
committerGitHub <noreply@github.com>2023-09-24 13:42:00 +0000
commitf4f6885c1f6949d2abfce7b58631afd33300b7fa (patch)
tree828189d17c8b26b0c1fb37c7e6ee0a3814dd7709 /web_src/js
parent64c0a6a4e2654bde9ad25eb8658e1cebd1282c6c (diff)
downloadgitea-f4f6885c1f6949d2abfce7b58631afd33300b7fa.tar.gz
gitea-f4f6885c1f6949d2abfce7b58631afd33300b7fa.zip
Fix Fomantic UI dropdown icon bug when there is a search input in menu (#27225) (#27228)
Backport #27225 by @wxiaoguang Fix #27224 And add the case to the devtest page. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/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;