Skip to content

Commit 3001d9e

Browse files
committed
use code fencing and syntax highlighting in the blog
1 parent d0c308c commit 3001d9e

File tree

1 file changed

+10
-10
lines changed
  • content/blog/entries/cc-search-accessibility-week9-10

1 file changed

+10
-10
lines changed

content/blog/entries/cc-search-accessibility-week9-10/contents.lr

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ The topics included in this post cover:
2222

2323
1. Tooltip accessibility and keyboard interactions
2424
2. Improve modal accessibility and implement trap focus
25-
3. Fix ```<label>``` for form elements
25+
3. Fix `<label>` for form elements
2626

2727
The first stage involved fixing the license explanation tooltips. These tooltips worked fine on click but did not respond to keypress events.
28-
The solution to overcome this was to use an event listener on the element which would would execute the ```showLicenseExplanation``` function onClick.
29-
Luckily ```VueJS``` provides this function inbuilt via the ```v-on:keyup``` attribute. So after change the code looks as follows:
28+
The solution to overcome this was to use an event listener on the element which would would execute the `showLicenseExplanation` function onClick.
29+
Luckily `VueJS` provides this function inbuilt via the `v-on:keyup` attribute. So after change the code looks as follows:
3030

31-
```
31+
```html
3232
<img
3333
:aria-label="$t('browse-page.aria.license-explanation')"
3434
tabindex="0"
@@ -42,7 +42,7 @@ Luckily ```VueJS``` provides this function inbuilt via the ```v-on:keyup``` attr
4242
```
4343

4444
Similar change was made to all the tooltips. The reason behind this error was that non-semantic element representation
45-
(i.e. using ```<div>```, ```<span>``` or ```<img>``` instead of a ```<button>```) does not register a keypress listener for these tags and hence they don't respond on keypress.
45+
(i.e. using `<div>`, `<span>` or `<img>` instead of a `<button>`) does not register a keypress listener for these tags and hence they don't respond on keypress.
4646

4747
The second change is related to modals. Modals have some stringent accessilibity parameters that have to be carefully handled.
4848
The criteria are:
@@ -55,9 +55,9 @@ To meet the criteria we developed a new [modal component](https://github.com/cre
5555
This modal has an overlay and closes when we press the **esc** key or click on the overlay. The modal also disables other elements when it is opened.
5656

5757
The final task achieved in the modal was the implementation of trap focus. For this we used the [vue-trap-focus library](https://github.com/posva/focus-trap-vue)
58-
The library exposes a ```<focus-trap>``` component which acts as wrapper to enable focus-trap. The implementation we used was:
58+
The library exposes a `<focus-trap>` component which acts as wrapper to enable focus-trap. The implementation we used was:
5959

60-
```
60+
```html
6161
<focus-trap :active="true">
6262
<div class="modal relative" aria-modal="true" role="dialog">
6363
<header
@@ -81,14 +81,14 @@ The library exposes a ```<focus-trap>``` component which acts as wrapper to enab
8181
</focus-trap>
8282
```
8383

84-
Apart from these the modal also has the ```aria-modal``` attribute and the ```role="dialog"``` attribute.
84+
Apart from these the modal also has the `aria-modal` attribute and the `role="dialog"` attribute.
8585
These attributes direct our screen readers to recognise this component as a modal and declare it whenever the modal opens.
8686

8787
The last improvement involves using appropriate label tags for the form elements. A lot of elements did not have proper labels or were nested in wrong way.
8888
These elements were fixed and after the fixing the nestings the elements had proper labels which the screen readers were able to identify.
8989
An example a proper input elements with correct label nesting is:
9090

91-
```
91+
```html
9292
<label class="checkbox" :for="item.code" :disabled="block(item)">
9393
<input
9494
type="checkbox"
@@ -103,7 +103,7 @@ An example a proper input elements with correct label nesting is:
103103
{{ $t(item.name) }}
104104
</label>
105105
```
106-
Notice how the input is a child of the ```<label>``` tag which has the ```for``` attribute to point which element it labels.
106+
Notice how the input is a child of the `<label>` tag which has the `for` attribute to point which element it labels.
107107

108108
Apart from these changes, the eslint configuration of the project were also changed to include a11y-linting for the elments.
109109
We used the [eslint-plugin-vue-a11y](https://github.com/maranran/eslint-plugin-vue-a11y) to enforce accessibility guidelines for our components via lint checks.

0 commit comments

Comments
 (0)