From 5c69d5710a34452846c4be2b91358b231cf235fe Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 11 Nov 2026 14:39:45 +0000 Subject: [PATCH] fix(ui): consistent spacing between labels (#40261) (#40330) Backport https://github.com/go-gitea/gitea/pull/40261 The issue reference popup showed its labels without any spacing, and the other label lists each used their own gap, with wrapped rows spaced differently from columns. `.labels-list` is now a wrapping flex list with `--gap-inline` by default, giving the popup, issue sidebar and project cards equal gaps in both directions. Lists inline with text, in issue list titles and timeline events, stay inline so their labels still wrap one by one. Issue reference popup, issue sidebar and issue
list labels, before and after Assisted-by: Claude Code:claude-opus-5-5 --- templates/shared/issuelist.tmpl | 2 +- web_src/css/modules/label.css | 23 ++++++++++++++++++----- web_src/css/repo.css | 6 ------ web_src/css/repo/issue-card.css | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index c363171a3f..cf6da3b1e1 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -15,7 +15,7 @@
-
+
{{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}} {{if .IsPull}} {{if (index $.CommitStatuses .PullRequest.ID)}} diff --git a/web_src/css/modules/label.css b/web_src/css/modules/label.css index 34997e16d9..9f6c34c0a9 100644 --- a/web_src/css/modules/label.css +++ b/web_src/css/modules/label.css @@ -224,10 +224,12 @@ a.ui.ui.ui.grey.label:hover { } /* labels-list layout: span.labels-list > a.item > span.ui.label, -by default, the labels list is rendered as "display: inline", -it can also be rendered as flex by adding flex-related classes (the general ".item" selector also applies) */ +by default, the labels list is rendered as a wrapping flex list, +lists flowing inline with text (issue title, comment event) are rendered as "display: inline" below */ .labels-list { - max-width: 100%; /* for ellipsis */ + display: flex; + flex-wrap: wrap; + gap: var(--gap-inline); font-size: var(--font-size-label); /* must match the label font size, otherwise the height mismatches */ } @@ -240,19 +242,30 @@ it can also be rendered as flex by adding flex-related classes (the general ".it } .labels-list .ui.label { + display: flex; /* block-level, so items have no line box and wrapped rows get the same gap as columns */ min-height: 20px; padding-top: 0; padding-bottom: 0; } +#issue-list .labels-list, +.timeline-item .labels-list { + display: inline; +} + +#issue-list .labels-list .ui.label, +.timeline-item .labels-list .ui.label { + display: inline-flex; +} + /* to align with different font sizes, these styles need to be written separately */ #issue-list .labels-list > .item { - margin-right: 4px; /* margin-right (not margin-left) keeps wrapped labels left-aligned */ + margin-right: var(--gap-inline); /* margin-right (not margin-left) keeps wrapped labels left-aligned */ vertical-align: 2.5px; /* compensates inline-flex baseline so labels center with text */ } .timeline-item .labels-list > .item { - margin-right: 4px; + margin-right: var(--gap-inline); vertical-align: 1.5px; } diff --git a/web_src/css/repo.css b/web_src/css/repo.css index ee9086c6ce..9a95e56f02 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -85,12 +85,6 @@ padding: 8px; } -.issue-content-right .ui.list.labels-list { - display: flex; - gap: var(--gap-inline); - flex-wrap: wrap; -} - .issue-content-right .empty-list { font-size: 12px; } diff --git a/web_src/css/repo/issue-card.css b/web_src/css/repo/issue-card.css index 327919b1fe..282aba1a00 100644 --- a/web_src/css/repo/issue-card.css +++ b/web_src/css/repo/issue-card.css @@ -36,7 +36,7 @@ display: flex; flex: 1; align-items: center; - gap: 0.25em; + gap: var(--gap-inline); flex-wrap: wrap; overflow: hidden; max-width: fit-content;