Fancy Tag

How the Fancy Tag works with a keyboard and assistive tech, and where it stands against WCAG 2.2 AA.

FreeReact and Vue
AAWCAG 2.2 target
6/9contrast pairs passing
3keyboard interactions

The Fancy Tag is a raised <span> with a label. Its close cross is a <button> named "Remove {label}" when onDismiss is passed; otherwise the cross is drawn but hidden. The active states are visual: the component has no toggle, so a selectable fancy tag needs one added.

Keyboard#

Tab

Moves to the close button, when there is one. The tag itself is not focusable.

Enter

On the close button: removes the tag.

Space

On the close button: removes the tag on key release.

Semantics#

<span>

The tag is text. The user-circle glyph is aria-hidden.

Always
<button aria-label="Remove …">

A real button with its own name. Override it with dismissAriaLabel.

onDismiss
aria-hidden

A cross that does nothing is hidden, so it is not announced as a control.

Cross without onDismiss
aria-disabled

On the tag; the close button is disabled.

Disabled
aria-pressed

Not set. If the tag toggles, render it as a <button aria-pressed>; colour alone does not tell anyone it is on.

Active - Grey, Active - Brand

Colour contrast#

Every variant and state has to meet WCAG 2.2 Level AA. Measure the colours as they land on screen: a translucent hover or press wash over whatever sits behind it.

4.5:1

Label · Default, Hover, Active

Satoshi Medium 12 against the white chip, or white on brand when active.

WCAG 1.4.3 Contrast (Minimum) ↗
3:1

Close cross · Dismissible

The cross takes the tag's ink, #2a2a2a on white (14.35:1), and white on brand when active (5.40:1).

WCAG 1.4.11 Non-text Contrast ↗
3:1

Focus indicator · Focus visible

When the close button has keyboard focus the whole tag rings: a 2.5px white gap, then 1.5px of #1a6ef8 (4.54:1 on white). It is thinner than the 2px used elsewhere.

WCAG 1.4.11 Non-text Contrast ↗WCAG 2.4.13 Focus Appearance ↗
24px

Target size · Close

The cross is 14px; its hit area is padded to 24 × 24.

WCAG 2.5.8 Target Size (Minimum) ↗

Measured contrast#

Label against the chip, measured from the Fancy Tag's tokens. Disabled is exempt as an inactive control. 3 of 9 pairs fall below their minimum (4.5:1 for text, 3:1 for graphics) and are marked in amber.

State · textDefaultHoverActive
Active - Grey · Label5.17passes5.17passes14.35passes
Active - Brand · Label5.17passes5.17passes5.40passes
Disabled · Label1.45below the minimum1.45below the minimum1.45below the minimum

Motion#

  • The lift and highlight change over 150ms, turned off under prefers-reduced-motion.

Checklist#

If the tag toggles, make it a <button aria-pressed>. The active states do not announce themselves.

After removal, move focus to the next tag or the field the tags belong to.

The focus ring is 1.5px. It passes 3:1 but is slim; check it can be seen on your surface.