Why did they leave without buying?
A shop has the teapots people want, a fair price and a good name, and still they leave at the checkout. Nobody is rude about it. They just could not work out what to press. A page that is hard to use loses people quietly, so the only way to know is to watch some of them try.
By the end of this lesson
Note
I can check a page for common problems and read the numbers of a usability test.
Key words
- Usability: how easily and how well people can reach their goal with a page.
- Accessibility: whether people with poor sight, a screen reader, a keyboard only or a small phone can use it too.
- Contrast ratio: how different the text colour is from the colour behind it, from 1 (the same) to 21 (black on white).
- Alt text: words that stand in for a picture when it cannot be seen.
- Success rate: the share of people who finished a task.
- Median: the middle value when the times are put in order.
Starter: what you already know
Note
Answer in your head. 1. What does a link look like on a page you use every day? 2. If five of ten people finish a task, what is the success rate? 3. What is the median of 3, 9 and 4? Answers: usually coloured or underlined text you can press; 50 per cent; 4, because in order they are 3, 4, 9.
Before you start
Note
Press Start the lab on the bar at the top of this lesson and wait until it says it is running. There is one container, jupyter, and the terminal reaches its Python with docker exec jupyter. JupyterLab is your workbench, port 8888, and Preview, port 8000, is the shop itself: open it in another tab. Each Run button below types its command into your lab's terminal, one after another in the same session. To watch them, or to type your own, press Open terminal on the bar.
A test starts with watching
ls lists the work folder: the shop, the two tables of results, the notes, the starter notebook and the scripts. cat notes.md prints what the observers wrote while twelve people tried the shop. Read them against the Preview: grey text hard to read, a Buy button pressed four times, a person asking what Error 7 is. Notes are not numbers yet, but they tell you where to look.
docker exec jupyter lsShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
docker exec jupyter cat notes.mdShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Contrast: can the text be read?
The script reads the colours in shop/style.css and works out the contrast ratio of each text and background pair. The usual contrast guideline asks for at least 4.5 for ordinary text. The body text, grey on white, scores 2.85, which is too low. The headline, dark grey on white, scores 15.91, which is plenty. Three more pairs fail, among them the link colour at 1.89.
docker exec jupyter python3 steps/contrast.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
An audit counts what a person would trip on
The audit reads the two pages and the style sheet and counts four common problems. On the home page 3 of 4 pictures have no alt text and 5 of 6 links say only things like "click here" or "read more", so a person listening to the links hears nothing about where each goes. On the checkout page 3 of 4 boxes have no label, and the one error message is only a code. In the style sheet one rule removes the focus outline, the line that shows a keyboard user where they are.
docker exec jupyter python3 steps/audit.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Check
Tip
Why is a placeholder inside a box not the same as a label? Answer: a placeholder disappears as soon as you type, and a screen reader may not read it as the box's name, so a label that stays is needed.
Reading a test: success and time
Twelve people each tried four tasks. pandas groups the rows by task and gives the success rate and the median time. Finding a teapot worked for everybody, in a median of 27.5 seconds. Paying for it was the hard part: only 50 per cent got through the last task, in a median of 110 seconds. The median is used because one very slow person would drag a mean upwards.
docker exec jupyter python3 steps/tasks.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Reading a test: the questionnaire and the mistakes
After the tasks each person answered ten questions from 1 to 5. The usual way of scoring turns the ten answers into one number from 0 to 100 for each person. The twelve scores run from 32.5 to 80.0, with a mean of 55.0, and scores around 68 are usually read as average, so people found this shop harder than most. The second script counts mistakes: the last task has 34, more than any other.
docker exec jupyter python3 steps/sus.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
docker exec jupyter python3 steps/errors.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
Fixing, and checking that it worked
Pick one problem, for example the focus outline, in JupyterLab open shop/style.css, change it, save, and refresh the Preview. Then run the script below. It fixes nothing itself: it runs the audit and the contrast check again, so the numbers change only if your edit did. A fix you cannot see in the numbers or in the Preview is a fix you cannot be sure of.
docker exec jupyter python3 steps/fix.pyShown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
A common mistake
Warning
Many people think that a page which passes every check is easy to use. The checks find common faults, but only people trying real tasks show whether they can reach their goal. Use the audit to find faults to fix and the test to know whether it mattered, and with twelve people say "many", not "all".
The same numbers in a notebook
Open JupyterLab from the bar and double-click start.ipynb. It loads the two tables and works out the same success rates, times and mistakes, one cell at a time. Click a cell and press Shift and Enter to run it. The last cell is where your own question goes: does the slowest person also give the lowest questionnaire score?
Exit check
Tip
Answer without looking back. 1. What ratio does the usual contrast guideline ask for with ordinary text? 2. Which problem does a label fix that a placeholder does not? 3. Why use the median time and not the mean? 4. Does a clean audit prove a page is easy to use? Answers: at least 4.5; a name that stays and that a screen reader reads; one very slow person does not drag it; no, only people trying real tasks show that.
For teachers
Tip
This lesson is a small example of a lesson worked in a lab: the steps and the Run buttons are the lesson, and the lab is each student's own copy. The lab is one service, JupyterLab with a small shop beside it on a second link, and nothing here marks itself: the student hands in the changed shop files, the before and after numbers of the audit and contrast scripts, and a short paragraph. Key learning points: 1. Contrast, labels, alt text, link words and focus are checked with numbers. 2. A usability test is read with success rate, median time and mistakes. 3. A fix is checked by running the audit again. Common mistake: taking a clean audit for proof of ease of use. Equipment: the lab and a browser. Tip: ask students to guess which task will be hardest before they run the numbers. The data is made up from a fixed seed, so every copy has the same numbers. Copy it into your own module and change it, or build one from scratch with the Lab menu in the lesson builder.