Writing tag and clicking enter not working #10156

Closed
opened 2025-11-02 08:59:48 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Ethan-Nox on GitHub (Jan 26, 2023).

Description

Hi,
When i'm inside an issue and i want to modify a tag i have a bug when typing the tagname and clicking enter.
It just do a reload and not apply my tag

Gitea Version

1.18.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

https://user-images.githubusercontent.com/60541446/214807733-0289f189-c7d7-4f22-99b3-582342622543.mov

Git Version

No response

Operating System

No response

How are you running Gitea?

Gitea is build and host on a local server

Database

None

Originally created by @Ethan-Nox on GitHub (Jan 26, 2023). ### Description Hi, When i'm inside an issue and i want to modify a tag i have a bug when typing the tagname and clicking enter. It just do a reload and not apply my tag ### Gitea Version 1.18.0 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots https://user-images.githubusercontent.com/60541446/214807733-0289f189-c7d7-4f22-99b3-582342622543.mov ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Gitea is build and host on a local server ### Database None
GiteaMirror added the type/bug label 2025-11-02 08:59:48 -06:00
Author
Owner

@sillyguodong commented on GitHub (Feb 13, 2023):

I was trying to find the JavaScript code for the keydown event bound to the item in dropdown.
But in the end, i was not able to locate the relevant code. 😔

@sillyguodong commented on GitHub (Feb 13, 2023): I was trying to find the JavaScript code for the `keydown` event bound to the item in dropdown. But in the end, i was not able to locate the relevant code. 😔
Author
Owner

@sillyguodong commented on GitHub (Feb 13, 2023):

I was trying to find the JavaScript code for the keydown event bound to the item in dropdown. But in the end, i was not able to locate the relevant code. 😔

I am guessing the code is in thesemantic.js.

@sillyguodong commented on GitHub (Feb 13, 2023): > I was trying to find the JavaScript code for the `keydown` event bound to the item in dropdown. But in the end, i was not able to locate the relevant code. 😔 I am guessing the code is in the` semantic.js `.
Author
Owner

@brechtvl commented on GitHub (Feb 17, 2023):

I've looked into this a bit but did not find a good solution so far. This change makes it so that on enter the label is applied, though the menu still closes immediately:

diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 61f82c8..4a824d7 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -85,6 +85,7 @@ export function initRepoCommentForm() {
     let hasUpdateAction = $listMenu.data('action') === 'update';
     const items = {};

+    $(`.${selector}`).dropdown({action: 'select'})
     $(`.${selector}`).dropdown('setting', 'onHide', () => {
       hasUpdateAction = $listMenu.data('action') === 'update'; // Update the var
       if (hasUpdateAction) {

However this breaks filtering. For example if I have a label name color/blue it no longer matches blue but does still match color. The relation is unclear to me.

Combined with the previous change, the menu can be made to not close on enter like this:

diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index f27bbb0..f4b0093 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -106,7 +106,7 @@
                        <div class="ui divider"></div>
                {{end}}

-               <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown">
+               <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown multiple">
                        <a class="text df ac muted">
                                <strong>{{.locale.Tr "repo.issues.new.labels"}}</strong>
                                {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}

However there is a delay in the event handling. Pressing enter the first time does nothing, and the second time it activates the label that was meant to be activated the first time. The event seems to be stuck in some jQuery event handler queue? I'm having trouble understanding how this all works.

@brechtvl commented on GitHub (Feb 17, 2023): I've looked into this a bit but did not find a good solution so far. This change makes it so that on enter the label is applied, though the menu still closes immediately: ``` diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 61f82c8..4a824d7 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -85,6 +85,7 @@ export function initRepoCommentForm() { let hasUpdateAction = $listMenu.data('action') === 'update'; const items = {}; + $(`.${selector}`).dropdown({action: 'select'}) $(`.${selector}`).dropdown('setting', 'onHide', () => { hasUpdateAction = $listMenu.data('action') === 'update'; // Update the var if (hasUpdateAction) { ``` However this breaks filtering. For example if I have a label name `color/blue` it no longer matches `blue` but does still match `color`. The relation is unclear to me. Combined with the previous change, the menu can be made to not close on enter like this: ``` diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index f27bbb0..f4b0093 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -106,7 +106,7 @@ <div class="ui divider"></div> {{end}} - <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown"> + <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown multiple"> <a class="text df ac muted"> <strong>{{.locale.Tr "repo.issues.new.labels"}}</strong> {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} ``` However there is a delay in the event handling. Pressing enter the first time does nothing, and the second time it activates the label that was meant to be activated the first time. The event seems to be stuck in some jQuery event handler queue? I'm having trouble understanding how this all works.
Author
Owner

@wxiaoguang commented on GitHub (Feb 20, 2023):

Try this one Make issue label dropdown support Enter #23014

@wxiaoguang commented on GitHub (Feb 20, 2023): Try this one Make issue label dropdown support Enter #23014
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10156