From 09ae5d887dd87a0b61713043070ca9fd5550a286 Mon Sep 17 00:00:00 2001
From: Carson Black <uhhadd@gmail.com>
Date: Apr 20 2024 19:05:33 +0000
Subject: Make user dashboard homepage accessible


---

diff --git a/pagure/templates/master.html b/pagure/templates/master.html
index 4e2bc55..128ab36 100644
--- a/pagure/templates/master.html
+++ b/pagure/templates/master.html
@@ -52,12 +52,12 @@
             <div class="dropdown-menu dropdown-menu-right">
               {% if config.get('ENABLE_NEW_PROJECTS', True) and config.get('ENABLE_UI_NEW_PROJECTS', True) %}
               <a class="dropdown-item" href="{{ url_for('ui_ns.new_project') }}">
-              <span class="fa {{projecticon()}}"></span> &nbsp;New {{projectstring()}}
+              <span class="fa {{projecticon()}}" aria-hidden="true"></span> &nbsp;New {{projectstring()}}
               </a>
               {% endif %}
               {% if config.get('ENABLE_GROUP_MNGT', False)  %}
               <a class="dropdown-item" href="{{ url_for('ui_ns.add_group') }}">
-              <span class="fa fa-users"></span> &nbsp;New Group
+              <span class="fa fa-users" aria-hidden="true"></span> &nbsp;New Group
               </a>
               {% endif %}
             </div>
diff --git a/pagure/templates/userdash_master.html b/pagure/templates/userdash_master.html
index fe9c47c..2f456e1 100644
--- a/pagure/templates/userdash_master.html
+++ b/pagure/templates/userdash_master.html
@@ -14,8 +14,8 @@
 <div class="container">
   <div class="row">
     <div class="col userdash-tabs">
-      <ul class="nav nav-tabs nav-sidetabs flex-column border-bottom-0">
-        <li class="pl-3 pb-3 font-weight-bold">
+      <ul class="nav nav-tabs nav-sidetabs flex-column border-bottom-0" role="tablist">
+        <li class="pl-3 pb-3 font-weight-bold" aria-hidden="true" >
             {{ g.fas_user.username | avatar(20) | safe }} {{g.fas_user.username}}
         </li>
 
@@ -26,14 +26,17 @@
           </form>
         </li>
 
-        <li class="nav-item text-dark">
+        <li class="nav-item text-dark" >
           <a class="nav-link d-flex align-items-center {{'active' if select=='projects'}}"
-            href="{{ url_for('ui_ns.index')}}">
-            <span>
-              <i class="fa {{projecticon()}} fa-fw text-muted"></i>
+            href="{{ url_for('ui_ns.index')}}"
+            aria-label="{{ userdash_counts['repos_length'] }} projects"
+            role="tab"
+            aria-selected="{{'true' if select=='projects' else 'false'}}">
+            <span aria-hidden="true">
+              <i class="fa {{projecticon()}} fa-fw text-muted" ></i>
               <span class="d-none d-md-inline">{{projectstring(plural=True)}}&nbsp;</span>
             </span>
-            <div class="ml-auto">
+            <div class="ml-auto" aria-hidden="true">
               <span class="badge badge-secondary">
                 {{ userdash_counts['repos_length'] }}
               </span>
@@ -44,12 +47,15 @@
         {% if userdash_counts['forks_length'] > 0 %}
         <li class="nav-item text-dark">
           <a class="nav-link d-flex align-items-center {{'active' if select=='forks'}}"
-            href="{{ url_for('ui_ns.userdash_forks')}}">
-            <span>
+            href="{{ url_for('ui_ns.userdash_forks')}}"
+            aria-label="{{ userdash_counts['forks_length'] }} forks"
+            role="tab"
+            aria-selected="{{'true' if select=='forks' else 'false'}}">
+            <span aria-hidden="true">
               <i class="fa fa-fw text-muted fa-code-fork"></i>
               <span class="d-none d-md-inline">Forks&nbsp;</span>
             </span>
-            <div class="ml-auto">
+            <div class="ml-auto" aria-hidden="true">
               <span class="badge badge-secondary">
                 {{ userdash_counts['forks_length'] }}
               </span>
@@ -62,8 +68,11 @@
 
         <li class="nav-item text-dark">
           <a class="nav-link d-flex align-items-center {{'active' if select=='activity'}}"
-            href="{{ url_for('ui_ns.userdash_activity')}}">
-            <span>
+            href="{{ url_for('ui_ns.userdash_activity')}}"
+            aria-label="Activity"
+            role="tab"
+            aria-selected="{{'true' if select=='activity' else 'false'}}">
+            <span aria-hidden="true">
               <i class="fa fa-fw text-muted fa-users"></i>
               <span class="d-none d-md-inline">Activity&nbsp;</span>
             </span>
@@ -73,12 +82,15 @@
         {% if userdash_counts['groups_length'] > 0 %}
         <li class="nav-item text-dark">
           <a class="nav-link d-flex align-items-center {{'active' if select=='groups'}}"
-            href="{{ url_for('ui_ns.userdash_groups')}}">
-            <span>
+            href="{{ url_for('ui_ns.userdash_groups')}}"
+            aria-label="{{ userdash_counts['groups_length'] }} groups"
+            role="tab"
+            aria-selected="{{'true' if select=='groups' else 'false'}}">
+            <span aria-hidden="true">
               <i class="fa fa-fw text-muted fa-users"></i>
               <span class="d-none d-md-inline">Groups&nbsp;</span>
             </span>
-            <div class="ml-auto">
+            <div class="ml-auto" aria-hidden="true">
               <span class="badge badge-secondary">
                 {{ userdash_counts['groups_length'] }}
               </span>
@@ -89,12 +101,15 @@
 
         <li class="nav-item text-dark">
           <a class="nav-link d-flex align-items-center {{'active' if select=='watchlist'}}"
-            href="{{ url_for('ui_ns.userdash_watchlist')}}">
-            <span>
+            href="{{ url_for('ui_ns.userdash_watchlist')}}"
+            aria-label="watchlist: {{ userdash_counts['watchlist_length'] }} items"
+            role="tab"
+            aria-selected="{{'true' if select=='watchlist' else 'false'}}">
+            <span aria-hidden="true">
               <i class="fa fa-fw text-muted fa-eye"></i>
               <span class="d-none d-md-inline">Watchlist&nbsp;</span>
             </span>
-            <div class="ml-auto">
+            <div class="ml-auto" aria-hidden="true">
               <span class="badge badge-secondary">
                 {{ userdash_counts['watchlist_length'] }}
               </span>
diff --git a/pagure/templates/userdash_projects.html b/pagure/templates/userdash_projects.html
index 1ae64a3..199a8a1 100644
--- a/pagure/templates/userdash_projects.html
+++ b/pagure/templates/userdash_projects.html
@@ -30,7 +30,7 @@
           <div class="row">
             <div class="col">
                   <span class="btn btn-sm btn-outline-secondary border-0 font-weight-bold">
-                      <span class="fa fa-fw fa-exclamation-circle"></span> {{filtered_repos_count}} {{projectstring(plural=True)}}
+                      <span class="fa fa-fw fa-exclamation-circle" aria-hidden="true"></span> {{filtered_repos_count}} {{projectstring(plural=True)}}
                   </span>
 
                 <div class="btn-group">
@@ -81,7 +81,7 @@
                       <form id="filters_form" action="{{ url_for('ui_ns.userdash_projects') }}" method="GET">
 
                         <div class="form-group row mb-1" id="acls-filter-group">
-                          <label for="acls" class="col-auto align-self-center pl-1 pr-0"><i class="text-muted fa fa-fw fa-user-secret"></i></label>
+                          <label for="acls" class="col-auto align-self-center pl-1 pr-0"><i class="text-muted fa fa-fw fa-user-secret" aria-hidden="true"></i></label>
                           <div class="col pl-1">
                             <select name="acl" id="acls-selectize" placeholder="ACLs">
                               <option value=""></option>
@@ -92,19 +92,19 @@
                             </select>
                           </div>
                           <div class="col-auto pl-0 pr-1 pt-1">
-                            <i class="fa fa-times fa-fw text-muted" id="acls-selectize-reset"></i>
+                            <i class="fa fa-times fa-fw text-muted" id="acls-selectize-reset" aria-label="Reset access control list filter"></i>
                           </div>
                         </div>
 
                         <div class="form-group row mb-2">
-                          <label for="search_pattern" class="col-auto align-self-center pl-1 pr-0"><i class="text-muted fa fa-fw fa-search"></i></label>
+                          <label for="search_pattern" class="col-auto align-self-center pl-1 pr-0"><i class="text-muted fa fa-fw fa-search" aria-hidden="true"></i></label>
                           <div class="col pl-1">
                             <input type="text" class="form-control"
                                     name="search_pattern" placeholder="Search"
                                     value="{{ search_pattern or '' }}" />
                           </div>
                           <div class="col-auto pl-0 pr-1 pt-1">
-                            <i class="fa fa-times fa-fw text-muted" id="search_pattern-selectize-reset"></i>
+                            <i class="fa fa-times fa-fw text-muted" id="search_pattern-selectize-reset" aria-label="Reset search filter"></i>
                           </div>
                         </div>
                         {#
@@ -211,7 +211,7 @@
                   {% if repo.avatar_email %}
                     <img src="{{ repo.avatar_email | avatar_url }}" width=20 height=20 />&nbsp;
                   {% else %}
-                    <span class="fa fa-fw {{projecticon()}} mr-1 text-semimuted"></span>
+                    <span class="fa fa-fw {{projecticon()}} mr-1 text-semimuted" aria-hidden="true"></span>
                   {% endif %}
                   <a href="{{url_for(
                     'ui_ns.view_repo',
@@ -226,15 +226,16 @@
                   {% endif %}
                     {% if r['grouplist']%}
                     <span class="btn btn-outline-secondary border-0 opacity-100 font-size-09 disabled font-weight-bold">
-                        <span class="fa fa-users fa-fw"></span>
+                        <span class="fa fa-users fa-fw" aria-hidden="true"></span>
                       {% for group in r["grouplist"]%}
                         {{group["group_name"]}} ({{group["access"]}})
                       {% endfor %}
                     </span>
                     {% endif %}
                     {% if r["access"] %}
-                    <span class="btn btn-outline-secondary border-0 opacity-100 font-size-09 disabled font-weight-bold">
-                      <span class="fa fa-user-secret fa-fw"></span>{{r["access"] if r["access"] != "main admin" else "maintainer"}}
+                    <span class="btn btn-outline-secondary border-0 opacity-100 font-size-09 disabled font-weight-bold"
+                    aria-label="your role: {{r["access"] if r["access"] != "main admin" else "maintainer"}}">
+                      <span class="fa fa-user-secret fa-fw" aria-hidden="true"></span>{{r["access"] if r["access"] != "main admin" else "maintainer"}}
                     </span>
                     {% endif %}
                   {# <div class="btn-group mr-2">
@@ -256,8 +257,9 @@
                   {% if config.get('ENABLE_TICKETS', True) and repo.settings.get('issue_tracker', True) %}
                       <a class="btn btn-sm btn-outline-primary font-weight-bold" data-toggle="tooltip"
                         href="{{ url_for('ui_ns.view_issues', repo=repo.name, namespace=repo.namespace) }}"
-                        title="{{ repo.open_tickets_public }} open issues against {{repo.name}}">
-                        <span class="fa fa-fw fa-exclamation-circle"></span>
+                        title="{{ repo.open_tickets_public }} open issues against {{repo.name}}"
+                        aria-label="{{ repo.open_tickets_public }} open issues against {{repo.name}}">
+                        <span class="fa fa-fw fa-exclamation-circle" aria-hidden="true"></span>
                         {{- repo.open_tickets_public }}
                       </a>
                   {% endif %}
@@ -267,8 +269,9 @@
                       repo=repo.name,
                       username=repo.user.username if repo.is_fork else None,
                       namespace=repo.namespace) }}"
-                      title="{{repo.open_requests}} open pull requests in {{repo.name}}">
-                      <span class="fa fa-fw fa-arrow-circle-down"></span>
+                      title="{{repo.open_requests}} open pull requests in {{repo.name}}"
+                      aria-label="{{repo.open_requests}} open pull requests in {{repo.name}}">
+                      <span class="fa fa-fw fa-arrow-circle-down" aria-hidden="true"></span>
                       {{- repo.open_requests}}
                     </a>
                     </div>
diff --git a/pagure/themes/default/templates/theme.html b/pagure/themes/default/templates/theme.html
index 5add14b..ead0a8f 100644
--- a/pagure/themes/default/templates/theme.html
+++ b/pagure/themes/default/templates/theme.html
@@ -44,8 +44,8 @@ href="{{ url_for('theme.static', filename='favicon.ico')}}?version={{ g.version}
             </p>
             <p>
               <a href="{{ url_for('ui_ns.ssh_hostkey') }}">SSH Hostkey/Fingerprint</a>
-              | <a href="https://docs.pagure.org/pagure/usage/index.html">Documentation</a>
-              | <a href="/about">About</a>
+              <span aria-hidden="true">|</span> <a href="https://docs.pagure.org/pagure/usage/index.html">Documentation</a>
+              <span aria-hidden="true">|</span> <a href="/about">About</a>
             </p>
             <p class="text-muted credit">&copy; Red Hat, Inc. and others.</p>
         </div>

