Skip to content

Archived label visual bug in labels select #27466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stuzer05 opened this issue Oct 6, 2023 · 17 comments · Fixed by #32760
Closed

Archived label visual bug in labels select #27466

stuzer05 opened this issue Oct 6, 2023 · 17 comments · Fixed by #32760
Labels

Comments

@stuzer05
Copy link
Contributor

stuzer05 commented Oct 6, 2023

Description

When you have archived non-exclusive label between exclusive label groups the double divider is shown in the place of archived label

Gitea Version

trunk

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image
image

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

None

@neel1996
Copy link
Contributor

The issue is due to the divider being rendered unconditionally

This has been fixed as part of #27668

@delvh
Copy link
Member

delvh commented Oct 17, 2023

I think the easiest approach to completely fix the problem is by refactoring the code completely.
As far as I know, @puni9869 is already working on sorting archived labels to the bottom of the search results, which will fix this problem as well and it will be much less error-prone.

@puni9869
Copy link
Member

puni9869 commented Oct 17, 2023

The issue is due to the divider being rendered unconditionally

This has been fixed as part of #27668

This is known issue.

puni9869 added a commit to puni9869/gitea that referenced this issue Oct 23, 2023
@wxiaoguang
Copy link
Contributor

Does the problem still exist in 1.23?

@wxiaoguang wxiaoguang added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Dec 8, 2024
@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

Does the problem still exist in 1.23?

It does
image

Gitea 6bd70d4

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

repo labels image
org labels image

@wxiaoguang
Copy link
Contributor

The problem is that tw-hidden doesn't work with the dropdown divider. It can't be fixed by template patches.

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

The problem is that tw-hidden doesn't work with the dropdown divider. It can't be fixed by template patches.

I don't know how labels work currently, but I'd imagine backend would for a merged list of labels aka. map[map[int64, string]] and frontend would just print that nested grouped map. With this logic, but would never happen

@wxiaoguang
Copy link
Contributor

The problem is that tw-hidden doesn't work with the dropdown divider. It can't be fixed by template patches.

I don't know how labels work currently, but I'd imagine backend would for a merged list of labels aka. map[map[int64, string]] and frontend would just print that nested grouped map. With this logic, but would never happen

It's not that easy. Frontend dropdown needs to "filter" the list. So it also needs to handle such case:

item1
divider
item2 (not matched the input and will be hidden by frontend)
divider (this will also be hidden)
item3

Actually the dropdown could already handles such case, but it is unable to mix these 2 different usages if item2 is hidden by other methods but not by the filter.

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

if item2 is hidden by other methods

Shouldn't those items that are hidden by other methods be non-existent for dropdown? Where am I missing?

@wxiaoguang
Copy link
Contributor

if item2 is hidden by other methods

Shouldn't those items that are hidden by other methods be non-existent for dropdown? Where am I missing?

  • Hidden by "archive": class="tw-hidden"
  • Hidden by "filter": class="filtered"
  • And filtered can't be used by "Hidden by 'archive'" (anther long story, you could take a try to see what would happen)

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

Maybe I fixed it, try this patch

image

diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl
index fb8f1a667..1d34cf7a7 100644
--- a/templates/repo/issue/sidebar/label_list.tmpl
+++ b/templates/repo/issue/sidebar/label_list.tmpl
@@ -21,5 +21,7 @@
 					{{$previousExclusiveScope := "_no_scope"}}
-					{{range $data.RepoLabels}}
+					{{$previousHadDivider := false}}
+					{{range $data.AllLabels}}
 						{{$exclusiveScope := .ExclusiveScope}}
-						{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
+						{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope) (ne $previousHadDivider true)}}
+							{{$previousHadDivider = true}}
 							<div class="divider"></div>
@@ -27,13 +29,6 @@
 						{{$previousExclusiveScope = $exclusiveScope}}
-						{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
-					{{end}}
-					{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
-					{{$previousExclusiveScope = "_no_scope"}}
-					{{range $data.OrgLabels}}
-						{{$exclusiveScope := .ExclusiveScope}}
-						{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
-							<div class="divider"></div>
+						{{if not .IsArchived}}
+							{{$previousHadDivider = false}}
+							{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
 						{{end}}
-						{{$previousExclusiveScope = $exclusiveScope}}
-						{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
 					{{end}}

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

maybe this is better

{{if not .IsArchived}}
	{{$previousHadDivider = false}}
{{end}}
{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

Tested, this patch fixes all cases, including archived label selected and not

diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl
index fb8f1a667..8fd0ff5dd 100644
--- a/templates/repo/issue/sidebar/label_list.tmpl
+++ b/templates/repo/issue/sidebar/label_list.tmpl
@@ -21,19 +21,11 @@
 					{{$previousExclusiveScope := "_no_scope"}}
-					{{range $data.RepoLabels}}
-						{{$exclusiveScope := .ExclusiveScope}}
-						{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
-							<div class="divider"></div>
+					{{range $data.AllLabels}}
+						{{if or (not .IsArchived) (.IsChecked)}}
+							{{$exclusiveScope := .ExclusiveScope}}
+							{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
+								<div class="divider"></div>
+							{{end}}
+							{{$previousExclusiveScope = $exclusiveScope}}
+							{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
 						{{end}}
-						{{$previousExclusiveScope = $exclusiveScope}}
-						{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
-					{{end}}
-					{{if and $data.RepoLabels $data.OrgLabels}}<div class="divider"></div>{{end}}
-					{{$previousExclusiveScope = "_no_scope"}}
-					{{range $data.OrgLabels}}
-						{{$exclusiveScope := .ExclusiveScope}}
-						{{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
-							<div class="divider"></div>
-						{{end}}
-						{{$previousExclusiveScope = $exclusiveScope}}
-						{{template "repo/issue/sidebar/label_list_item" dict "Label" .}}
 					{{end}}

@wxiaoguang
Copy link
Contributor

No, it won't work.

See this: Fix duplicate dropdown dividers #32760

@stuzer05
Copy link
Contributor Author

stuzer05 commented Dec 8, 2024

No, it won't work.

See this: Fix duplicate dropdown dividers #32760

But it does, see screenshots #32758

@wxiaoguang wxiaoguang removed the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Dec 8, 2024
wxiaoguang added a commit that referenced this issue Dec 9, 2024
Fix #27466

The problem is that any item in the menu could be hidden, pure CSS won't
work, and dropdown's builtin "hideDividers" doesn't work with our "scope
dividers". The newly introduced "archived" label makes the dividers
regression more.
@puni9869
Copy link
Member

puni9869 commented Dec 9, 2024

@stuzer05 Thanks for the taking this forward. Now a days I am packed up. This was in my todo list from last year. But unfortunately I could not able to fix it.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
5 participants