Improve accessibility of navigation bar and footer (#22635)

Added ARIA navigation landmark to navigation bar and aria label for both
nav bar and footer.

Contributed by @forgejo.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
(cherry picked from commit b0e3382834)
This commit is contained in:
Felipe Leopoldo Sologuren Gutiérrez 2023-01-28 22:29:10 -03:00 committed by Loïc Dachary
parent 42e27a4559
commit 820e26c22d
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2
3 changed files with 10 additions and 4 deletions

View file

@ -106,6 +106,12 @@ never = Never
rss_feed = RSS Feed rss_feed = RSS Feed
[aria]
navbar = Navigation Bar
footer = Footer
footer.software = About Software
footer.links = Links
[filter] [filter]
string.asc = A - Z string.asc = A - Z
string.desc = Z - A string.desc = Z - A

View file

@ -1,6 +1,6 @@
<footer> <footer role="group" aria-label="{{.locale.Tr "aria.footer"}}">
<div class="ui container"> <div class="ui container">
<div class="ui left"> <div class="ui left" role="contentinfo" aria-label="{{.locale.Tr "aria.footer.software"}}">
<a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.locale.Tr "powered_by" "Gitea"}}</a> <a target="_blank" rel="noopener noreferrer" href="https://gitea.io">{{.locale.Tr "powered_by" "Gitea"}}</a>
{{if (or .ShowFooterVersion .PageIsAdmin)}} {{if (or .ShowFooterVersion .PageIsAdmin)}}
{{.locale.Tr "version"}}: {{.locale.Tr "version"}}:
@ -15,7 +15,7 @@
{{.locale.Tr "template"}}{{if .TemplateName}} {{.TemplateName}}{{end}}: <strong>{{call .TemplateLoadTimes}}</strong> {{.locale.Tr "template"}}{{if .TemplateName}} {{.TemplateName}}{{end}}: <strong>{{call .TemplateLoadTimes}}</strong>
{{end}} {{end}}
</div> </div>
<div class="ui right links"> <div class="ui right links" role="group" aria-label="{{.locale.Tr "aria.footer.links"}}">
{{if .ShowFooterBranding}} {{if .ShowFooterBranding}}
<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a> <a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">{{svg "octicon-mark-github"}}<span class="sr-only">GitHub</span></a>
{{end}} {{end}}

View file

@ -1,4 +1,4 @@
<div class="ui container" id="navbar"> <div class="ui container" id="navbar" role="navigation" aria-label="{{.locale.Tr "aria.navbar"}}">
{{$notificationUnreadCount := 0}} {{$notificationUnreadCount := 0}}
{{if .IsSigned}} {{if .IsSigned}}
{{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}} {{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}