On this page

Attachment

Keys, what Attachment gives you and what your team does.

Conformance

Attachment meets WCAG 2.2 level AA when used as described on these pages.

Keyboard

Key Action
Tab Moves focus to the trigger (if there is one), then to each action.
Enter Opens the file from the trigger, or presses the focused action.
Space Presses a trigger button or an action.
← → Scroll an attachment group sideways once it is scrolled into and focused by a pointer.

What Attachment gives you

  • A native button (or your link) as the trigger, covering the card, so the whole card is one target.
  • The Button focus ring around the card while the trigger has keyboard focus, and on each action.
  • Actions sit above the trigger, so they stay clickable.
  • States shown by edge, colour and text together, never by colour or transparency alone.
  • Text pairs from the contrast check: color.text.subtle and color.text.danger reach 4.5:1 on the card and its hover.

What your team does

  • Name the trigger: sr-only text such as “Open invoice-10482.pdf”, or an aria-label.
  • Name each action with the file: “Remove invoice-10482.pdf”.
  • Put the progress and errors in the description, in words. Announce upload results with a status message (role="status") if people are not watching the card.
  • Give an image preview an empty alt when the file name is next to it.
  • A group of attachments: role="list" on the group and role="listitem" on each card, with an aria-label on the list.

WCAG criteria

Criterion Level How
1.4.1 Use of Color A Error shown by edge colour and the reason in words
1.4.3 Contrast (Minimum) AA Text token pairs at 4.5:1 or more
2.1.1 Keyboard A Trigger and actions are native buttons or links
2.4.7 Focus Visible AA Button focus ring on the card and on actions
4.1.2 Name, Role, Value A Trigger and actions named by your text