Skip to content
easeweb
Search topics

Colour pickers you can only drag, with no field to type

A brand colour picker's square and hue strip move only by dragging their handles, so nothing in it takes focus, says the colour, or lets one be typed.

WCAG 2.2
SC 2.1.1ASC 4.1.2ASC 2.5.7AA· new in 2.2
Required by
Section 508 · EN 301 549 (EU)
Broken <span class="hex">#366cd9</span>
The accessibility problem illustrated: Motor:Where do I type my colour?
01

The problem

People who can't drag, and screen reader users, can't set the brand colour or find out what it is set to

02

Try it

Change the brand colour with the mouse, then put the mouse aside and try again with Tab

Drag the handles, then click the square somewhere else. The panel shows what a screen reader announces. Can you set the colour without dragging, or type #2a9d8f?

Broken Can you fix this?

BrokenA square and a hue strip that only a drag moves
Brand colour
#366cd9

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let people choose a colour without dragging

Before
BrokenA square and a hue strip that only a drag moves
<div class="brand-colour">  <span class="label">Brand colour</span>  <div class="sv-area" style="background-color: hsl(220 100% 50%)">    <span class="handle" style="left: 75%; top: 15%"></span>  </div>  <div class="hue-strip">    <span class="handle" style="left: 61%"></span>  </div>  <div class="preview" aria-hidden="true" style="--brand: #366cd9">…</div>  <span class="hex">#366cd9</span></div>
What is wrong4 points
  • The picker can't be used from the keyboard: its handles can't take focus, so Tab never reaches them.
  • Assistive technology doesn't know the picker is there: the handles have no role, name or value.
  • Every colour needs a drag: the script listens for a press on the handles alone, so a press anywhere else on the square does nothing.
  • No one can type a colour in: the code is written out as text, not in a field.
After

A hex field beside the picker

<div class="brand-colour" role="group" aria-labelledby="brand-label">  <span class="label" id="brand-label">Brand colour</span>  <div class="sv-area" style="background-color: hsl(220 100% 50%)" aria-hidden="true">    <span class="handle" style="left: 75%; top: 15%"></span>  </div>  <div class="hue-strip" aria-hidden="true">    <span class="handle" style="left: 61%"></span>  </div>  <div class="preview" aria-hidden="true" style="--brand: #366cd9">…</div>  <label for="brand-hex">Hex</label>  <input type="text" id="brand-hex" value="#366cd9" maxlength="7" spellcheck="false" autocomplete="off"></div>
How it is fixed5 steps
  1. Make the picker a group, named "Brand colour" by its label through aria-labelledby.
  2. Add a labelled text field, "Hex", that takes the colour as a code, by typing, pasting or voice. It is native, so it is in the Tab order with a role, a name ("Hex", in the group "Brand colour") and a value.
  3. When a valid code is typed, pass it to the picker's own setColour(), so the handles and the preview move to it.
  4. Have the drag write into the field, so it always shows the colour the handles have set.
  5. Put aria-hidden on the drag-only square and strip, so a screen reader meets the field and not two handles with no role or name.

This fixes the Before and passes 2.1.1, 4.1.2 and 2.5.7. The picker stays as it was for people who like to drag. It is the smallest change to an existing picker, and it gives everyone an exact value. But it is not enough on its own: a keyboard or voice user who wants the same blue a little lighter has to work out a new code, while a mouse user just moves the handle. It suits a setting where people arrive with a code, such as a brand guide, more than one where they choose by eye.

04

Design ideas

A colour can be typed, or picked from a palette, sliders or a wheel, all without a drag

Five ways to draw the brand colour setting. Try each with clicks only, then Tab to it and use the arrow keys or type: four can be set without a drag and tell a screen reader what they are set to, and one gives a screen reader nothing but “button”.

In the design file

  • Draw the colour’s code as a field people can type into, not as a line of text.
  • Draw the field open and closed, and open the picker where it doesn’t cover the next field.
  • Note that a click on the square, the strip or the wheel moves the handle there, as well as a drag.
  • Give every colour in a palette a name people can read, such as Ocean or Coral, and show it on screen.
  • Draw each handle as a white ring with a dark edge, and with its focus ring.

Passes

  • A hex field that opens a picker Closed, a compact field with the colour in a small square at its start. Clicked or reached with Tab, it opens a small square and hue strip under it without taking the cursor out of the field: typing still works, a click in the square or the strip sets the colour without a drag, and Escape closes it. Keyboard users set the colour by its code.
  • Brand colour
    Swatch chips with their names Each colour is a pill with a dot and its name, the edge #6b7280 at 4.83:1; the chosen one takes a 2px #1a1a1a edge and a tick. People who can’t tell Forest from Slate read the name, a screen reader hears it, and the arrow keys move between the colours.
  • Brand colour

    Three sliders that each draw their range Hue, saturation and brightness each get a track painted with the colours it runs through, and the value written at its end, “220°”, “75%”. A tap anywhere on a track sets it there, and the arrow keys step it, so no colour needs a drag.
  • Brand colour
    A colour wheel that takes a click A ring of hues with the chosen colour in the middle and its name under it. A click or tap anywhere on the ring moves the handle there, the way WCAG’s own example of a colour wheel works, and the arrow keys turn it round.

Fails

  • Brand colour
    Swatch dots with no namesWCAG 4.1.2 Five neat dots, the chosen one with a tick. Tab reaches each, but a screen reader says only “button” five times, with nothing to tell Ocean from Coral or which one is chosen, and voice control has no name to call them by.
05

Verify the fix

5 checks.

Test with: Keyboard, Screen reader, Mouse, 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 picker or its library changes.

Limits

This is a starting pattern, not a guarantee for every application. Screen readers differ in how they read range inputs: some read the value before the name, and on iOS they move by swiping up and down rather than with keys. The browser's own colour pickers change between versions, so check the ones your users have. A single slider for a price or a volume is covered in range sliders that only move by dragging, and gestures in general in pinch, drag and tilt gestures with no button. Whether white text stays readable on the colour someone picks is a separate check: see low-contrast text on brand colours, photos and hover states. Test the complete setting 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.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service