mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-23 08:24:37 +00:00
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:
51 files changed
+162
-147
No files matched your search
+17
-1
@@ -22,18 +22,34 @@ Gitea's private styles use `g-` prefix.
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* interact-xx classes can be used standalone, reset the <a> and <button> styles to default text styles */
|
||||
.interact-fg, .interact-bg, .interact-link {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
text-align: left;
|
||||
line-height: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.interact-fg { color: inherit !important; }
|
||||
.interact-fg:hover { color: var(--color-primary) !important; }
|
||||
.interact-fg:active { color: var(--color-primary-active) !important; }
|
||||
.interact-fg.disabled:hover { color: inherit !important; }
|
||||
|
||||
.interact-bg { background: transparent !important; }
|
||||
.interact-bg:hover { background: var(--color-hover) !important; }
|
||||
.interact-bg:active { background: var(--color-active) !important; }
|
||||
|
||||
/* sometimes, we'd like to make "<button>" look like a link */
|
||||
.interact-link { color: var(--color-primary); cursor: pointer; }
|
||||
.interact-link { color: var(--color-primary); }
|
||||
.interact-link:hover { text-decoration: underline; }
|
||||
|
||||
.interact-danger:hover { color: var(--color-danger) !important; }
|
||||
|
||||
/* primary-color dot centered on the top-right corner of the element */
|
||||
.indicator-dot {
|
||||
position: relative;
|
||||
|
||||
Reference in new issue
Block a user