Labeling Interactive Elements
Moss identifies interactive elements on the page by their accessible names. When a button contains only an SVG icon and no visible text, Moss cannot determine what the button does and will be unable to reference it in guided instructions. Adding anaria-label to icon-only buttons fixes this and also improves accessibility for screen reader users.
The Problem
Buttons that contain only an SVG icon have no accessible name:The Fix
Add anaria-label attribute that describes what the button does:
Adding
aria-hidden="true" to the SVG marks it as decorative. The button’s aria-label carries the meaning instead.Using Component Libraries
If you use a component library and don’t manage raw HTML elements directly,aria-label still works. React forwards all aria-* props to the underlying DOM element, so this applies to any component that renders a clickable element.
- MUI
- Chakra UI
- Ant Design
- Radix / shadcn/ui
Custom Icon Button Components
If your team has a shared icon button wrapper, make sure it passes througharia-label by spreading rest props onto the underlying element:
Buttons With Tooltips
If a button already has a tooltip, use that same text as thearia-label:
Writing Good Labels
- Describe the action, not the icon. Users and Moss need to know what the button does.
- Keep it concise — 1 to 3 words is usually enough.
- Skip the label if visible text exists. A button that already says “Save” next to an icon does not need
aria-label.
Finding Unlabeled Buttons
Run this snippet in your browser console to find buttons that need labels:Summary
This is also a WCAG 2.1 requirement (Success Criterion 4.1.2: Name, Role, Value), so adding these labels improves accessibility for all users.