Not accessible

React told me off!

@PraeSongprasit and @WebAccessClub

Wireframe of a website, with icon and navigation at the top, hero image, then text content

Why test code?

Reduce errors on complex interactive sites

Simplified UI of 4 to-do list states, empty, with an item added, done, and archived

React
Testing Library

Enforce user centric tests

						
							<Button
								label="Add a new fish"
								onClick="this.showFishInput"
							/>
							
							<Input
								aria-label="Fish name"
								class="fishInput"
							/>
							
							fireEvent.showFishInput()

							expect(<Input class="fishInput"/>) to render 🤯
							
						
					
						
							<Button
								label="Add a new fish"
								onClick="this.showFishInput"
							/>
							
							<Input
								aria-label="Fish name"
								class="fishInput"
							/>
							
							userEvent.click(screen.getByText('Add a new fish'));

							expect(
								screen.getByRole('input', { name: 'Fish name' })
							).toBeInTheDocument(); ❤️
						
					
Simplified UI of 2 identical looking interactive elements, which could be a select box or a dropdown. One element's accessible name is Fish habitat, fresh water. Another element's name is Fish habitat.
Simplified UI of 2 identical looking interactive elements. The first element, which is a select input, has a visible label called Fish Habitat, showing that Fresh water option was selected. Its accessible name is Fish habitat, Fresh water. Another element is a custom dropdown menu with both visible and accessible name of Fish habitat.

What about React?

Improved docs,
development assistance, & bundling

						
							<img src="fishyImage.png"/>

							(image-alt):
							Ensures <img> elements have alternate text
							or a role of none or presentation


							<button tabindex="2">
								Add a new fish
							</button>

							(tabindex):
							Ensures tabindex attribute values
							are not greater than 0
						
					

Create React App

Create React App logo

People can
ignore tests?!

Yes... but you can make it harder

Bake it in

TDD, prevent commits & stop deploys

React told me off

...but not all the time

Bots don't know UX

Good HTML & copy...
We need humans for that

Accessibility is a mindset,
not a standalone activity

@PraeSongprasit and @WebAccessClub