Skip to content
easeweb
Search topics

Quantity steppers with unnamed buttons and no typing

The minus and plus beside a product's quantity are icon buttons with no name around a printed number, or the quantity is a number field whose keys a script cancels, so a screen reader hears only "button" and nobody can type how many they want.

WCAG 2.2
SC 4.1.2ASC 2.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken <button type="button" class="step"><svg>…</svg></button>
The accessibility problem illustrated: No vision:Which button adds a mug?
01

The problem

Screen reader users can't tell which button adds a mug and which takes one away, nobody can type a quantity, and where the field's keys are blocked, keyboard users can't change it at all.

02

Try it

Set the quantity to 4 without the mouse: Tab to the stepper, then type 4, or use its buttons or the up arrow.

The panel shows what a screen reader says. In Broken 1, what are the two buttons called, and can you type a number? In Broken 2, type 4 or press the up arrow, then click the small arrows in the field with the mouse.

Broken Can you fix this?

Enamel mug $18

Quantity
1

Screen reader says:

(Tab to the stepper)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Name the minus and plus by what they do, and make the quantity a labelled number field that takes typing and the arrow keys.

  1. 1Each button in the stepper has a name in words that says what it does.
  2. 2The quantity is a labelled field that can be typed into.
  3. 3No script cancels the keys a number field takes.
Before

Unnamed icon buttons around a printed number

<form class="buy" action="/basket" method="post">  <span class="qty-label">Quantity</span>  <div class="stepper">    <button type="button" class="step" data-step="-1">      <svg class="icon" viewBox="0 0 16 16">…</svg>    </button>    <span class="qty">1</span>    <button type="button" class="step" data-step="1">      <svg class="icon" viewBox="0 0 16 16">…</svg>    </button>  </div>  <input type="hidden" name="quantity" value="1">  <button type="submit">Add to bag</button></form>
After

Named buttons around a number field

<form class="buy" action="/basket" method="post">  <label for="qty" class="qty-label">Quantity</label>  <div class="stepper">    <button type="button" class="step" data-step="-1">      <svg class="icon" viewBox="0 0 16 16" aria-hidden="true">…</svg>      <span class="visually-hidden">Decrease quantity</span>    </button>    <input id="qty" name="quantity" type="number" min="1" max="10" value="1">    <button type="button" class="step" data-step="1">      <svg class="icon" viewBox="0 0 16 16" aria-hidden="true">…</svg>      <span class="visually-hidden">Increase quantity</span>    </button>  </div>  <button type="submit">Add to bag</button></form>

Fixing this with an AI coding assistant? Get this guide as Markdown, or get every guide in your coding agent.

04

Design ideas

A light, modern stepper can still be read and typed into.

Four ways to draw the mug’s quantity. Click each one, then put the mouse aside and Tab to it: three can be set from the keyboard and say what they are, and one only answers a pointer.

In the design file

  • Write each button’s name beside it, such as Decrease quantity and Increase quantity, or Remove for a bin.
  • Draw the number as a box that can be typed into, with the caret and the focus ring in it.
  • Give the quantity its label, Quantity, even where the design doesn’t show it.
  • Draw the stepper at its lowest and highest quantity, with both buttons still there.

Passes

  • One pill, the number typed in the middle The minus, the number and the plus share one 46px pill in a soft #f1f3f5 grey with a #8a929c edge, 3.15:1 on white, the buttons white circles inside it. The number is a field with no box of its own: a click or Tab puts the caret in it, and the whole pill takes the focus ring.
  • Enamel mug $18
    A bin in place of the minus at 1 In a basket row, the minus turns into a bin when the quantity is 1, so the same place removes the item. Its name changes with its icon, from “Decrease quantity” to “Remove Enamel mug”, and the row that replaces the item offers Undo.
  • A dropdown of quantities “Quantity 1” in a navy-edged pill, as many large shops draw it, is the browser’s own dropdown under the styling: a tap opens the system’s list, Tab reaches it and the arrow keys choose from it, and it is read with its label and value. It suits a small limit; past about ten, typing is quicker than a long list.

Fails

  • Quantity 1
    Small chevrons stacked beside the numberWCAG 2.1.1 A compact counter: the number in a box with an up and a down chevron stacked beside it, drawn as icons that only a click answers. Tab goes straight past them, nothing can be typed, and a screen reader finds no control, so without a pointer the number stays at 1.
05

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Touch

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the stepper component or the theme changes.

Limits

This is a starting pattern, not a guarantee for every application. Screen readers name a number field's role in different words, and some read its number before its label. Steppers that set a guest count, a number of nights or a time follow the same pattern, but a stepper that steps through words, such as sizes, is a different control: a select or a group of radio buttons. If your control moves along a track, see range sliders that only move by dragging; for icon buttons elsewhere on the page, such as a header's search and menu, see icon-only buttons with no accessible name. Test the full journey from product page to basket with your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work