fix: use button to replace anchor elements without href (#40338)

Elements `<a>` without `href` are not focus-able, screen readers didn't
expose it as a button.

Use `<button type="button">` for these elements, and fix what the
conversion exposed:

- Disabled reactions and the copy-content button use `aria-disabled`,
because native `disabled` suppresses their tooltips
- The random label color button gets a label
- Hover, disabled and alignment styles that only matched `<a>` apply to
the buttons
- Unpinning an issue with the keyboard works, and removing a
non-permitted "blocked by" dependency sends the right type

Fixes: https://github.com/go-gitea/gitea/issues/40337

Assisted-by: Claude Code:claude-opus-5-5

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
authored and GitHub committed 2026-11-16 17:48:41 +00:00
1 parent 2f89c68b64
commit 8b48b45def
51 files changed
+162 -147

No files matched your search

+2 -2
View File
@@ -13,8 +13,8 @@
}
.btn.is-loading > *,
.btn-octicon.is-loading > *,
.button.is-loading > * {
.button.is-loading > *,
button.is-loading > * {
opacity: 0;
}
+8
View File
@@ -2,6 +2,7 @@
cursor: pointer;
display: inline-flex;
align-items: center;
vertical-align: middle; /* align buttons with/without svg icon */
min-width: 0;
outline: none;
font-family: var(--fonts-regular);
@@ -50,6 +51,8 @@
color: var(--color-text);
}
button:disabled,
.btn:disabled,
.ui.buttons .disabled.button:not(.basic),
.ui.disabled.button,
.ui.button:disabled,
@@ -306,6 +309,11 @@
border: none;
}
.btn.disabled {
cursor: default;
opacity: var(--opacity-disabled);
}
/* sometimes, we'd like to make "<a href>" look like a button */
a.btn,
a.btn:hover {
+3
View File
@@ -95,6 +95,9 @@
padding: 9px 14px;
border-radius: var(--border-radius);
color: inherit;
border: none;
text-align: left;
line-height: inherit;
background: inherit;
text-decoration: none;
gap: 10px;