# Accessibility
## General Practices
As a general rule, accessible software is achieved by following web development best practices. As Treeherder uses the [reactstrap](https://reactstrap.github.io/) library, it is recommended to use one of its components, if possible.
If you can not find a suitable component, prefer [HTML5 semantic tags](https://developer.mozilla.org/en-US/docs/Glossary/Semantics#Semantics_in_HTML) and avoid using generic tags, such as `span` and `div`. Moreover, try to use more **headings** (`h1` to `h6`) whenever possible, because screen readers users usually navigate by headings and that is only possible when developers insert them in the code.
If you can build your layout neither with reactstrap nor with semantic tags, please insert `aria-role` in them. There are examples of how to use `aria-role` in: [Tables](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Table_Role), [Progress Bar](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_progressbar_role), [List](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/List_role).
`aria-role` is important because it gives meaning to the generic HTML tag. That gives some direction to screen readers on which functionalities to provide and some information to users.
**In summary**, implement your layout trying to use these in the following order:
1. Use reactstrap;
2. Use HTML semantic tags;
3. Use `aria-role` attributes.
### Font Awesome
Treeherder also uses the `Font Awesome` library for some icons. Usually, there is no need to insert an additional explanation to them. However, if the icon has a semantic meaning, you can insert it by adding a `title` prop in the `FontAwesomeIcon` component.
```jsx
```
## Colors
Treeherder uses [Bootstrap color](https://getbootstrap.com/docs/4.0/utilities/colors/) utility classes. A few colors were modified in order to meet [WCAG standards](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast?utm_source=devtools&utm_medium=a11y-panel-checks-color-contrast) for color contrast.
Please use this custom color according to the following table:
| Bootstrap Color | Treeherder Color |
| ---------------: | :--------------------- |
| `btn-info` | `btn-darker-info` |
| `text-info` | `text-darker-info` |
| `btn-secondary` | `btn-darker-secondary` |
| `text-secondary` | `text-darker-secondary` |
For example, if inserting a text color into an element, use `className="text-darker-info"`, instead of using `className="text-info"`.
In some reactstrap components, you can insert a `prop` specifying its color. In that case, you use only the color name, without its prefix.
| Component prop color |
| :------------------: |
| `darker-info` |
| `darker-secondary` |
For example:
```jsx
```
Known reactstrap components that accept the `color` prop and work with custom Treeherder colors: `Badge`, `Button`, `Card`, `DropdownToggle`, `FormText`, `NavBar`, `Progress`, `Spinner`.
In case you need to add more custom colors, please add on [treeherder-custom-styles.css](https://github.com/mozilla/treeherder/blob/master/ui/css/treeherder-custom-styles.css#L348) style sheet.
### Inserting new colors
If you add new colors to the style sheets, please make sure the text and background color combination passes the minimum contrast ratio defined by WCAG.
In order to check if it passes, you can use [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/) or use [Firefox's Accessibility Devtools](https://developer.mozilla.org/en-US/docs/Tools/Accessibility_inspector#Check_for_accessibility_issues).
### Red and Green
Red and green colors are not very noticeable for some types of color deficiency. For that reason, it is recommended to insert an accompanying icon, such as a checkmark (for success) or an exclamation point (for warning or error).
For that task, `FontAwesome` is a supported choice.
## Images
### Image HTML tag
If you add an image, make sure you also write an alternative text for it. The text should be descriptive and support the screen reader user.
```jsx
```
If you are not sure how to write this, please refer to [this guide](https://webaim.org/techniques/alttext/).
### SVG
For SVG images, do the following:
- `