From 0ac3be14829125f0c12be4e69195e6cb095353f4 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Thu, 23 Feb 2023 10:32:15 +0200 Subject: [PATCH] Improve accessibility for issue comments (#22612) (#23083) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Lunny Xiao Co-authored-by: John Olheiser --- templates/repo/issue/view_content.tmpl | 6 +++--- templates/repo/issue/view_content/comments.tmpl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 887dd2c42..08ba50904 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -27,7 +27,7 @@ {{end}}
-
+
{{if .Issue.OriginalAuthor}} @@ -69,7 +69,7 @@ {{end}}
-
+
{{if .Issue.RenderedContent}} {{.Issue.RenderedContent|Str2html}} @@ -85,7 +85,7 @@
{{$reactions := .Issue.Reactions.GroupByType}} {{if $reactions}} -
+
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
{{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 8894a7ffd..94b46bd9f 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -22,7 +22,7 @@ {{end}}
-
+
{{if .OriginalAuthor}} @@ -69,7 +69,7 @@ {{end}}
-
+
{{if .RenderedContent}} {{.RenderedContent|Str2html}} @@ -85,7 +85,7 @@
{{$reactions := .Reactions.GroupByType}} {{if $reactions}} -
+
{{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
{{end}}