From 8b48b45def542c8a9598ecdc2e00710532a18a7f Mon Sep 17 00:00:00 2001 From: Lazizbek Ergashev Date: Mon, 16 Nov 2026 17:48:41 +0000 Subject: [PATCH] fix: use button to replace anchor elements without href (#40338) Elements `` without `href` are not focus-able, screen readers didn't expose it as a button. Use ` {{end}} diff --git a/templates/admin/stacktrace-row.tmpl b/templates/admin/stacktrace-row.tmpl index 689f44c54b0..77f5333efb5 100644 --- a/templates/admin/stacktrace-row.tmpl +++ b/templates/admin/stacktrace-row.tmpl @@ -17,10 +17,11 @@
{{if or (eq .Process.Type "request") (eq .Process.Type "normal")}} - {{svg "octicon-trash" 16 "tw-text-red"}} + >{{svg "octicon-trash" 16 "tw-text-red"}} {{end}}
diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl index ab7d00972c9..2943ebabb60 100644 --- a/templates/devtest/gitea-ui.tmpl +++ b/templates/devtest/gitea-ui.tmpl @@ -37,11 +37,16 @@
  • -

    Inline / Plain:

    +

    Button reset and interact

    - - - + + + + +
    +
    + +
  • @@ -147,15 +152,5 @@ - -
    -

    ComboMarkdownEditor

    - {{template "shared/combomarkdowneditor" dict "MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorGeneral nil)}} -
    - -

    Tailwind CSS Demo

    -
    - -
    {{template "devtest/devtest-footer"}} diff --git a/templates/repo/actions/view_component.tmpl b/templates/repo/actions/view_component.tmpl index b855257ecc0..b1260eb17ba 100644 --- a/templates/repo/actions/view_component.tmpl +++ b/templates/repo/actions/view_component.tmpl @@ -47,6 +47,7 @@ data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}" data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}" data-locale-download-file="{{ctx.Locale.Tr "repo.download_file"}}" + data-locale-delete-file="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}" data-locale-copy-output="{{ctx.Locale.Tr "copy_output"}}" data-locale-logs-always-auto-scroll="{{ctx.Locale.Tr "actions.logs.always_auto_scroll"}}" data-locale-logs-always-expand-running="{{ctx.Locale.Tr "actions.logs.always_expand_running"}}" diff --git a/templates/repo/actions/workflow_dispatch.tmpl b/templates/repo/actions/workflow_dispatch.tmpl index be37649ce97..588e757bece 100644 --- a/templates/repo/actions/workflow_dispatch.tmpl +++ b/templates/repo/actions/workflow_dispatch.tmpl @@ -8,11 +8,11 @@
    -
    +
    -
    diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 729d60b8c13..de0ae8cb312 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -173,7 +173,7 @@
    {{if $file.IsIncomplete}} {{ctx.Locale.Tr "repo.diff.file_suppressed"}} - {{ctx.Locale.Tr "repo.diff.load"}} + {{else}} {{ctx.Locale.Tr "repo.diff.bin_not_shown"}} {{end}} @@ -226,10 +226,10 @@ {{ctx.Locale.Tr "repo.diff.too_many_files" (len .Diff.Files) .DiffShortStat.NumFiles}} - {{ctx.Locale.Tr "repo.diff.show_more"}} + >{{ctx.Locale.Tr "repo.diff.show_more"}}
    {{end}}
    diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 6651e1bb979..8dc9cb9c027 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -203,7 +203,7 @@ {{else if .CanCreatePullRequest}}
    {{ctx.Locale.Tr "repo.pulls.new.description"}} - {{ctx.Locale.Tr "repo.pulls.new"}} +
    {{template "repo/issue/new_form" .}} diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index cdb6ba35f1a..b716a7e5fad 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -19,7 +19,7 @@
    {{ctx.Locale.Tr "repo.diff.review.header"}} - {{svg "octicon-x" 16}} +
    {{template "shared/combomarkdowneditor" (dict diff --git a/templates/repo/header/watch.tmpl b/templates/repo/header/watch.tmpl index 0c666c9a185..9f16c39937f 100644 --- a/templates/repo/header/watch.tmpl +++ b/templates/repo/header/watch.tmpl @@ -15,28 +15,28 @@ {{else}} diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index 5a467924efe..c3e684ea388 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -16,9 +16,9 @@
    {{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}} {{if and $.isPinnedIssueCard $.Page.IsRepoAdmin}} - + {{end}}
    diff --git a/templates/repo/issue/label_precolors.tmpl b/templates/repo/issue/label_precolors.tmpl index 7be3f40350a..c7ce9b2b1de 100644 --- a/templates/repo/issue/label_precolors.tmpl +++ b/templates/repo/issue/label_precolors.tmpl @@ -1,27 +1,27 @@
    - -
    +
    diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl index d73323f5286..9d9227056d0 100644 --- a/templates/repo/issue/milestone_new.tmpl +++ b/templates/repo/issue/milestone_new.tmpl @@ -29,7 +29,7 @@
    diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl index 88e3e990980..fa4655c6fd6 100644 --- a/templates/repo/issue/sidebar/assignee_list.tmpl +++ b/templates/repo/issue/sidebar/assignee_list.tmpl @@ -9,9 +9,9 @@ >
    {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - {{svg "octicon-trash" 16}} - + {{end}}
    @@ -65,11 +65,11 @@
    {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - {{svg "octicon-trash" 16}} - + {{end}}
    @@ -90,11 +90,11 @@
    {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - {{svg "octicon-trash" 16}} - + {{end}}
    diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl index 3eb7ba8d7a5..cd209285702 100644 --- a/templates/repo/issue/sidebar/label_list.tmpl +++ b/templates/repo/issue/sidebar/label_list.tmpl @@ -6,9 +6,9 @@ > @@ -150,10 +150,10 @@ diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index 1698e862d32..85060d81502 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -44,8 +44,8 @@
    {{if .EscapeStatus.Escaped}} - {{ctx.Locale.Tr "repo.unescape_control_characters"}} - {{ctx.Locale.Tr "repo.escape_control_characters"}} + + {{end}} {{if and .CanWriteWiki (not .Repository.IsMirror)}} {{ctx.Locale.Tr "repo.wiki.edit_page_button"}} diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl index be79d0fed42..1270582122f 100644 --- a/templates/shared/actions/runner_list.tmpl +++ b/templates/shared/actions/runner_list.tmpl @@ -24,11 +24,11 @@
    diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 454b99c24bd..0013855c999 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -21,9 +21,7 @@ {{$issue.Title | ctx.RenderUtils.RenderIssueSimpleTitle}} {{if $issue.IsPull}} {{if (index $root.CommitStatuses $issue.PullRequest.ID)}} - {{/* make the "flex" children align with parent "inline" */}} - {{template "repo/commit_statuses" dict "Status" (index $root.CommitLastStatus $issue.PullRequest.ID) "Statuses" (index $root.CommitStatuses $issue.PullRequest.ID)}} - + {{template "repo/commit_statuses" dict "Status" (index $root.CommitLastStatus $issue.PullRequest.ID) "Statuses" (index $root.CommitStatuses $issue.PullRequest.ID) "AdditionalClasses" "tw-text-16 tw-align-[calc(0.5cap-9px)]"}} {{end}} {{end}} diff --git a/templates/shared/reactions.tmpl b/templates/shared/reactions.tmpl index b716be20ad9..a410bb8ecee 100644 --- a/templates/shared/reactions.tmpl +++ b/templates/shared/reactions.tmpl @@ -7,14 +7,14 @@
    {{range $value := $allowedReactions}} - {{ReactionToEmoji $value}} + {{end}}
    {{end}} {{range $key, $value := .Reactions}} {{$hasReacted := $value.HasUser ctx.RootData.SignedUserID}} - {{ReactionToEmoji $key}} {{len $value}} - + {{end}} {{end}} diff --git a/templates/user/auth/grant.tmpl b/templates/user/auth/grant.tmpl index 6ad0c9febc4..1cdb1aa9a3f 100644 --- a/templates/user/auth/grant.tmpl +++ b/templates/user/auth/grant.tmpl @@ -25,8 +25,8 @@ - - + + diff --git a/tests/integration/release_test.go b/tests/integration/release_test.go index bba35d334e5..2fe7fea3785 100644 --- a/tests/integration/release_test.go +++ b/tests/integration/release_test.go @@ -283,8 +283,10 @@ func TestReleaseReaction(t *testing.T) { resp := session.MakeRequest(t, NewRequest(t, "GET", "/user2/repo1/releases"), http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) - AssertHTMLElement(t, htmlDoc, `.bottom-reactions a.ui.label[data-reaction-content="heart"]`, 1) + AssertHTMLElement(t, htmlDoc, `.bottom-reactions .ui.label[data-reaction-content="heart"]`, 1) AssertHTMLElement(t, htmlDoc, `.reaction-picker [data-reaction-content="-1"]`, 0) + htmlDoc = NewHTMLParser(t, MakeRequest(t, NewRequest(t, "GET", "/user2/repo1/releases"), http.StatusOK).Body) + AssertHTMLElement(t, htmlDoc, `.bottom-reactions .ui.label[data-reaction-content="heart"][aria-disabled="true"]:not([disabled])`, 1) session.MakeRequest(t, reactReq(1, "unreact", "heart"), http.StatusOK) unittest.AssertCount(t, &issues_model.Reaction{ReleaseID: 1}, 0) diff --git a/web_src/css/features/colorpicker.css b/web_src/css/features/colorpicker.css index a353532f4e5..ef8c929d620 100644 --- a/web_src/css/features/colorpicker.css +++ b/web_src/css/features/colorpicker.css @@ -44,6 +44,9 @@ } .color-picker-combo .precolors .color { + border: none; + border-radius: 0; + padding: 0; display: inline-block; width: 15px; height: 15px; diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index 95608cb4bbb..37d6f620e4d 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -22,18 +22,34 @@ Gitea's private styles use `g-` prefix. text-overflow: ellipsis; } +/* interact-xx classes can be used standalone, reset the and 0) { const {invalidTopics} = responseData; - const topicLabels = queryElemChildren(topicDropdown, 'a.ui.label'); + const topicLabels = queryElemChildren(topicDropdown, '.ui.label'); for (const [index, value] of topics.split(',').entries()) { if (invalidTopics.includes(value)) { topicLabels[index].classList.remove('green'); @@ -98,7 +98,7 @@ export function initRepoTopicBar() { }; const query = stripTags(this.urlData.query.trim()); let found_query = false; - const current_topics = Array.from(queryElemChildren(topicDropdown, 'a.ui.label.visible'), (el) => el.getAttribute('data-value')); + const current_topics = Array.from(queryElemChildren(topicDropdown, '.ui.label.visible'), (el) => el.getAttribute('data-value')); if (res.topics) { let found = false; diff --git a/web_src/js/features/repo-issue-list.ts b/web_src/js/features/repo-issue-list.ts index be8b233178e..fad5a4425d7 100644 --- a/web_src/js/features/repo-issue-list.ts +++ b/web_src/js/features/repo-issue-list.ts @@ -145,7 +145,7 @@ function initPinRemoveButton() { const response = await DELETE(el.getAttribute('data-unpin-url')!); if (response.ok) { // Delete the tooltip - el._tippy.destroy(); + el._tippy?.destroy(); // Remove the Card el.closest(`div.issue-card[data-issue-id="${CSS.escape(String(id))}"]`)!.remove(); }