Skip to content
easeweb
Search topics

Tag chips whose × the keyboard never reaches

A Skills tag input draws each chip's × as an svg with a click handler, so Tab never stops on it and only the last chip can be removed, with Backspace.

WCAG 2.2
SC 2.1.1A
Required by
Section 508 · EN 301 549 (EU)
Broken <svg class="chip-remove" viewBox="0 0 16 16">
The accessibility problem illustrated: Motor:How do I remove Research?
01

The problem

Keyboard users can't remove a chip from the middle of a tag input, so a skill added by mistake stays on the profile

02

Try it

Without the mouse, remove Research from Skills

Tab into Skills: Tab never stops on an ×, and Backspace in the empty field removes only the last chip, Writing. Clicking an × works.

Apply the fix: Tab now stops on each × before the field, and removing one moves focus to the next.

Broken Can you fix this?

BrokenAn × that only a mouse can press
Design Research Writing

Screen reader says:

(Tab to Skills)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Make each chip's × a named button that Tab reaches

Before
BrokenAn × that only a mouse can press
<label for="skill-input">Skills</label><div class="tags">  <span class="chips">    <span class="chip">      Design      <svg class="chip-remove" data-index="0" viewBox="0 0 16 16">…</svg>    </span>    <span class="chip">      Research      <svg class="chip-remove" data-index="1" viewBox="0 0 16 16">…</svg>    </span>    <span class="chip">      Writing      <svg class="chip-remove" data-index="2" viewBox="0 0 16 16">…</svg>    </span>  </span>  <input id="skill-input" type="text" placeholder="Add a skill"></div>
What is wrong3 points

The field has a label and adds chips from the keyboard. Removing them is where it fails.

  • Each × is an svg that can't take focus, so Tab goes past it.
  • No key presses an ×, so no chip in the middle of the row can be removed.
  • Backspace in the empty field removes only the last chip.
After
FixA button on every chip
<label for="skill-input">Skills</label><div class="tags">  <span class="chips">    <span class="chip">      Design      <button type="button" class="chip-remove" data-index="0" aria-label="Remove Design">        <svg viewBox="0 0 16 16" aria-hidden="true">…</svg>      </button>    </span>    <span class="chip">      Research      <button type="button" class="chip-remove" data-index="1" aria-label="Remove Research">        <svg viewBox="0 0 16 16" aria-hidden="true">…</svg>      </button>    </span>    <span class="chip">      Writing      <button type="button" class="chip-remove" data-index="2" aria-label="Remove Writing">        <svg viewBox="0 0 16 16" aria-hidden="true">…</svg>      </button>    </span>  </span>  <input id="skill-input" type="text" placeholder="Add a skill"></div>
How it is fixed5 steps
  1. Make each × a button holding the svg, and hide the svg with aria-hidden="true". Tab now stops on it, and Enter or Space presses it.
  2. Name it with aria-label after its chip, "Remove Research": the button holds only a picture, so without a label it would have no name, and "Remove" alone doesn't say which chip goes.
  3. Give it a 24 by 24 pixel box and a focus ring of its own, so the small × is easy to hit and easy to see when Tab reaches it.
  4. When a chip goes, its button goes with it, so move focus to the next chip's button, the one before when there is no next, or the field when no chip is left. Without that, the focused button is gone and focus falls back to the page itself.
  5. Keep Backspace in the empty field as a shortcut for the last chip.

The chips keep their look. This fixes the Before and passes 2.1.1.

Why this fix: Use native HTML first

04

Design ideas

A chip can look like anything, as long as Tab reaches its ×

Three more ways sites draw a row of chips. Click them, then put the mouse aside and try them with Tab, Enter and Space: two pass, and one has an × that Tab never reaches.

In the design file

  • Name each chip’s × as a button in the design file, so it is built on the real element.
  • Write each × button’s name beside it, with its chip’s word, such as “Remove Design”.
  • Draw every × with its focus ring, as it looks when reached with Tab, in a box of at least 24 by 24 pixels.
  • Mark where focus goes after a chip is removed, the next chip or, when none is left, the field.
  • Keep each × visible at rest, not only on hover, since keyboard users never hover, and touch users see it only after a tap, if at all.

Passes

  • DesignWriting
    Chips cut short by a “+2 more” button Two chips show, then a “+2 more” button that opens the rest and says it is open. Every chip, shown or opened, has its own × button, so none is out of reach.
  • DesignWritingResearchCoding
    A chip row that ends in Clear all Each chip keeps its own × button, and a Clear all button in #115e59 (7.58:1) ends the row, so everything can go in one press. When it is pressed, focus moves to the field, since every button around it is gone.

Fails

  • Design Writing Research Coding
    Clean chips whose × shows on hoverWCAG 2.1.1 At rest the chips are plain words; pointing at one shows its ×. The × is not a button, so Tab never reaches it, and on a touch screen it shows only after a tap, if at all. Try it with Tab.
05

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Forced colors

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 shared chip or tag component changes.

Limits

This is a starting pattern for a short row of chips typed in by the person. It doesn't cover chips that can be edited in place, reordered by dragging, or loaded from a server. Test the complete journey, with your real data, in the browsers and assistive technology you support.

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