|
| 1 | +title: CC Search, Initial Accessibility Improvements |
| 2 | +--- |
| 3 | +categories: |
| 4 | +cc-search |
| 5 | +community |
| 6 | +gsoc |
| 7 | +open-source |
| 8 | + |
| 9 | +--- |
| 10 | +author: AyanChoudhary |
| 11 | +--- |
| 12 | +series: gsoc-2020-ccsearch-accessibility |
| 13 | +--- |
| 14 | +pub_date: 2020-07-25 |
| 15 | +--- |
| 16 | +body: |
| 17 | + |
| 18 | +These are the seventh and eighth weeks of my internship with CC. I am working on improving the accessibility of cc-search and internationalizing it as well. |
| 19 | +This post contains details of my work done to make initial accessibility improvements to homepage and the other static pages. |
| 20 | + |
| 21 | +With the internationalization work complete, our next target were the accessiblity improvements. So I decided to tackle the homepage and the static pages first. |
| 22 | +The aforementioned pages had the following accessiblity issues: |
| 23 | + |
| 24 | +1. No aria-label on links |
| 25 | +2. Improper landmarks |
| 26 | +3. Improper aria-control nestings |
| 27 | +4. Some elements not being read by the screen-reader |
| 28 | +5. Color contrast Issues(to be covered later) |
| 29 | + |
| 30 | +But before working I ran another set of audit tests to exactly pin-point these issues. I used [NVDA](https://www.nvaccess.org/) for running these audits. |
| 31 | +Lets go through the fixes one at a time. |
| 32 | + |
| 33 | +The first issue of no aria-label was pre-dominantly found in the footer. we had some links such as: |
| 34 | +``` |
| 35 | +<a |
| 36 | + href="https://www.instagram.com/creativecommons" |
| 37 | + class="social has-text-white" |
| 38 | + target="_blank" |
| 39 | + rel="noopener" |
| 40 | +> |
| 41 | +``` |
| 42 | + |
| 43 | +These links did not contain any aria-label and were read as **cc link**. So the aria-labels had to be added ```aria-label="instagram link"``` in this case which fixed this problem. |
| 44 | + |
| 45 | +The next issue was of improper landmarks. Most of the pages had no **main** landmark and some had no **complimentary** or **region** landmarks even though they were required in those pages. |
| 46 | +These landmarks had to be added after the carefully scrutinising the pages in the audits. |
| 47 | + |
| 48 | +The next issue was of improper aria-control nestings. This is interesting as it involves having some deeper understanding of the roles involved. So I will explain this in a little depth. |
| 49 | +The area where we had this issue was in feedback page. The code involved was: |
| 50 | + |
| 51 | +``` |
| 52 | +<ul> |
| 53 | + <li :class="tabClass(0, 'tab')"> |
| 54 | + <a |
| 55 | + href="#panel0" |
| 56 | + :aria-selected="activeTab == 0" |
| 57 | + @click.prevent="setActiveTab(0)" |
| 58 | + > |
| 59 | + Help us Improve |
| 60 | + </a> |
| 61 | + </li> |
| 62 | + <li :class="tabClass(1, 'tab')"> |
| 63 | + <a |
| 64 | + href="#panel1" |
| 65 | + :aria-selected="activeTab == 1" |
| 66 | + @click.prevent="setActiveTab(1)" |
| 67 | + > |
| 68 | + Report a Bug |
| 69 | + </a> |
| 70 | + </li> |
| 71 | +</ul> |
| 72 | +``` |
| 73 | +The reason why this is an error is because of the ```aria-selected``` attribute can only be applied to an element having the role **tab** nested inside a **tablist** element. |
| 74 | +For reference, in the above example the ```<ul>``` should have the role **tablist** and each ```<li>``` element should have the role **tab**. And so the ```aria-selected``` attribute should be in the ```<li>``` element instead of the ```<a>``` tag. |
| 75 | + |
| 76 | +The corrected code is: |
| 77 | +``` |
| 78 | +<ul role="tablist"> |
| 79 | + <li role="tab" :class="tabClass(0, 'tab')" :aria-selected="activeTab == 0"> |
| 80 | + <a |
| 81 | + aria-label="help us improve form" |
| 82 | + href="#panel0" |
| 83 | + @click.prevent="setActiveTab(0)" |
| 84 | + > |
| 85 | + {{ $t('feedback.improve') }} |
| 86 | + </a> |
| 87 | + </li> |
| 88 | + <li role="tab" :class="tabClass(1, 'tab')" :aria-selected="activeTab == 1"> |
| 89 | + <a |
| 90 | + aria-label="report a bug form" |
| 91 | + href="#panel1" |
| 92 | + @click.prevent="setActiveTab(1)" |
| 93 | + > |
| 94 | + {{ $t('feedback.bug') }} |
| 95 | + </a> |
| 96 | + </li> |
| 97 | +</ul> |
| 98 | +``` |
| 99 | + |
| 100 | +Another interesting finding involved the screen readers not reading particular special characters such as ```~``` and ```|```. |
| 101 | +This issue was quite pronounced in the search guide page where these symbols were used in plenty in both links as well as texts. |
| 102 | +So I had to phonetically write these out in the aria-labels of the links to make the screen reader read them out loud. |
| 103 | +The corresponding changes are: |
| 104 | + |
| 105 | +``` |
| 106 | +<a |
| 107 | + aria-label="dog vertical bar cat" |
| 108 | + href="https://search.creativecommons.org/search?q=dog%7Ccat" |
| 109 | +> |
| 110 | + <em>dog|cat</em> |
| 111 | +</a> |
| 112 | +``` |
| 113 | + |
| 114 | +After all these changes we had some increase in the accessibility scores(computed from lighthouse): |
| 115 | + |
| 116 | +1. About Page: 78 -> 97 | +19 |
| 117 | +2. Search-Guide Page: 76 -> 97 | +23 |
| 118 | +3. Feedback Page: 75 -> 97 | +22 |
| 119 | + |
| 120 | +Whoosh!! That was quite a lot. We are done with these two weeks for now. Hope to see you in the next post as well. |
| 121 | + |
| 122 | +You can track the work done for these weeks through these PRs: |
| 123 | + |
| 124 | +1. [Accessibility](https://github.com/creativecommons/cccatalog-frontend/pull/1068) |
| 125 | +2. [Accessibility Improvements](https://github.com/creativecommons/cccatalog-frontend/pull/1072) |
| 126 | + |
| 127 | +The progress of the project can be tracked on [cc-search](https://github.com/creativecommons/cccatalog-frontend) |
| 128 | + |
| 129 | +CC Search Accessiblity is my GSoC 2020 project under the guidance of [Zack Krida](https://creativecommons.org/author/zackcreativecommons-org/) and [Ari Madian](https://opensource.creativecommons.org/blog/authors/akmadian/), who is the primary mentor for this project, [Anna Tumadóttir](https://creativecommons.org/author/annacreativecommons-org/) for helping all along and engineering director [Kriti |
| 130 | +Godey](https://creativecommons.org/author/kriticreativecommons-org/), have been very supportive. |
0 commit comments