Purpose of These DocsThese docs are meant as a starting point for using Anvil2 accessibly. While the contents can contribute to building accessible interfaces from scratch, that is not the main goal.
Overview
Directly Related WCAG Guidelines(s):- 2.2.2 Pause, Stop, Hide (Level A)
- 3.2.1 On Focus (Level A)
- 3.2.2 On Input (Level A)
- 4.1.2 Name, Role, Value (Level A)
- 4.1.3 Status Messages (Level AA)
| Anvil2 Responsibility | Implementor Responsibility |
|---|---|
| Anvil2 ensures built-in status announcements, loading states, and ARIA attribute management for changing states in the components. | Implementors ensure that the changing content is clearly written and can be controlled when necessary. |
Status Updates
Directly Related WCAG Guidelines(s):- 3.3.1 Error Identification (Level A)
- 3.3.3 Error Suggestion (Level AA)
- 3.3.4 Error Prevention (Level, Financial, Data) (Level AA)
- 4.1.3 Status Messages (Level AA)
| Anvil2 Responsibility | Implementor Responsibility |
|---|---|
| Anvil2 ensures status components, automatic ARIA live regions, and form validation status management. | Implementors ensure that the changing content is clearly written and has a logical flow. |
Best Practices
- Write clear, helpful status messages appropriate for the type of status being displayed
- Keep important messages persistent with clear next-step actions or instructions
- Use appropriate status types (success, error, warning) that match the message content
Common Pitfalls
- Using vague or unhelpful status messages that don’t guide users
- Assigning status types that don’t match the content (e.g., using “error” styling for success messages)
- Overwhelming users with too many status messages or auto-hiding critical information
Loading States
Directly Related WCAG Guidelines(s):- 2.2.2 Pause, Hide, Stop (Level A)
- 3.2.2 On Input (Level A)
- 4.1.2 Name, Role, Value (Level A)
- 4.1.3 Status Messages (Level AA)
| Anvil2 Responsibility | Implementor Responsibility |
|---|---|
| Anvil2 ensures automatic ARIA attributes and built-in loading spinners with state management to components that have the option. There is also a standalone Spinner component for use in other areas. | Implementors ensure that the loading state is being applied at the correct time and that the spinner is added to custom components where appropriate. |
Best Practices
- Provide clear feedback for both visual users and assistive technologies about what is loading
- For long-running processes, display a progress indicator and provide a cancel option
- Announce loading state changes to screen readers using ARIA attributes
Common Pitfalls
- Providing vague or missing feedback about state changes
- Blocking page interaction without offering a way to cancel the operation
- Failing to communicate loading status to assistive technologies
Progress Indicators
Directly Related WCAG Guidelines(s):- 1.4.1 Use of Color (Level A)
- 2.2.2 Pause, Stop, Hide (Level A)
- 4.1.2 Name, Role Value (Level A)
- 4.1.3 Status Messages (Level AA)
| Anvil2 Responsibility | Implementor Responsibility |
|---|---|
| Anvil2 ensures automatic ARIA attributes, visual styling, and accessibility support via a ProgressBar component. | Implementors ensure that there is clear messaging/controls that accompany the progress indicator and proper calculation of time. |
Best Practices
- Clearly communicate both the progress percentage and what operation is being performed
- Provide controls to pause or cancel the operation when appropriate
- Use proper ARIA attributes like
role="progressbar"witharia-valuenow,aria-valuemin, andaria-valuemax
Common Pitfalls
- Using vague or overly elaborate descriptions that confuse users
- Relying solely on visual progress bars without text or ARIA attributes
- Blocking page interaction during long operations without providing a cancel option
Collapsible Content
Directly Related WCAG Guidelines(s):- 1.3.1 Info and Relationships (Level A)
- 2.1.1 Keyboard (Level A)
- 2.1.2 No Keyboard Trap (Level A)
- 2.4.3 Focus Order (Level A)
- 4.1.2 Name, Role Value (Level A)
| Anvil2 Responsibility | Implementor Responsibility |
|---|---|
| Anvil2 ensures components that have proper integration with accessibility patterns for collapsible content and keyboard controls. | Implementors ensure that there is a logical flow and handles proper state management for the content being collapsed |
Best Practices
- Write clear, descriptive trigger text that indicates what content will be revealed
- Use
aria-expandedto communicate current state to assistive technologies - Organize content in a logical way that makes sense when collapsed or expanded
- Ensure keyboard navigation works properly for expand/collapse controls
Common Pitfalls
- Using unclear trigger text that doesn’t describe the hidden content
- Grouping unrelated content together in collapsible sections
- Failing to update
aria-expandedwhen state changes