Skip to content

Commit 0ac3be1

Browse files
yardenshohamMenelionlunnyjolheiser
authored
Improve accessibility for issue comments (#22612) (#23083)
Backport #22612 ### Preamble Gitea is an extremely great and smart solution perfectly suitable for smaller systems and self-hosted Git-powered setups. However, there is a group of people who have indredible difficulties in using Gitea, rendering it useless in many cases. Those people are blind developers using [screen readers](https://en.wikipedia.org/wiki/Screen_reader). Unfortunately, the frontend framework is super convoluted, and Go templates don’t allow accessibility improvements in a straightforward way. As a blind developer myself, I'm trying to start fixing smaller accessibility quirks with intention to go deeper and eventually, alone or not, make Gitea at least mostly accessible for screen reader users. ### What This Fix Does My blind fellows and me navigate webpages not very similarly to how a sighted person does it. For instance, we love semantic HTML markup like headings, lists, tables etc. because our screen readers allow us to jump by those landmarks with a single keypress. Currently in Gitea issue comments are not marked up with headings. I'm trying to fix this by adding an appropriate [ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) role for comment header and also by enclosing the comment itself in a semantical article element. Co-authored-by: Andre Polykanine <ap@oire.me> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
1 parent 75eaf99 commit 0ac3be1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: templates/repo/issue/view_content.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</a>
2828
{{end}}
2929
<div class="content comment-container">
30-
<div class="ui top attached header comment-header gt-df gt-ac gt-sb">
30+
<div class="ui top attached header comment-header gt-df gt-ac gt-sb" role="heading" aria-level="3">
3131
<div class="comment-header-left gt-df gt-ac">
3232
{{if .Issue.OriginalAuthor}}
3333
<span class="text black gt-bold">
@@ -69,7 +69,7 @@
6969
{{end}}
7070
</div>
7171
</div>
72-
<div class="ui attached segment comment-body">
72+
<div class="ui attached segment comment-body" role="article">
7373
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}>
7474
{{if .Issue.RenderedContent}}
7575
{{.Issue.RenderedContent|Str2html}}
@@ -85,7 +85,7 @@
8585
</div>
8686
{{$reactions := .Issue.Reactions.GroupByType}}
8787
{{if $reactions}}
88-
<div class="ui attached segment reactions">
88+
<div class="ui attached segment reactions" role="note">
8989
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
9090
</div>
9191
{{end}}

Diff for: templates/repo/issue/view_content/comments.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</a>
2323
{{end}}
2424
<div class="content comment-container">
25-
<div class="ui top attached header comment-header gt-df gt-ac gt-sb">
25+
<div class="ui top attached header comment-header gt-df gt-ac gt-sb" role="heading" aria-level="3">
2626
<div class="comment-header-left gt-df gt-ac">
2727
{{if .OriginalAuthor}}
2828
<span class="text black gt-bold gt-mr-2">
@@ -69,7 +69,7 @@
6969
{{end}}
7070
</div>
7171
</div>
72-
<div class="ui attached segment comment-body">
72+
<div class="ui attached segment comment-body" role="article">
7373
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
7474
{{if .RenderedContent}}
7575
{{.RenderedContent|Str2html}}
@@ -85,7 +85,7 @@
8585
</div>
8686
{{$reactions := .Reactions.GroupByType}}
8787
{{if $reactions}}
88-
<div class="ui attached segment reactions">
88+
<div class="ui attached segment reactions" role="note">
8989
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
9090
</div>
9191
{{end}}

0 commit comments

Comments
 (0)