Best Practices for WCAG 2.1 Compliance
Introduction
This guide provides best practices for making Lottie animations accessible, along with a Voluntary Product Accessibility Template (VPAT) to help assess compliance. By following these guidelines, developers and designers can create Lottie animations that are not only visually appealing but also inclusive and accessible to a wider audience.
1. Perceivable
Text Alternatives
- Provide text alternatives for Lottie animations using
aria-label
oraria-labelledby
attributes. - Offer a concise description of what the animation conveys.
Time-based Media
- Include a text description of the animation’s content and purpose.
Distinguishable
- Ensure sufficient contrast for any text or crucial visual information in the animation.
- Respect user preferences for reduced motion.
2. Operable
Keyboard Accessibility
- Make sure all interactive elements in the animation can be controlled via keyboard.
- Ensure the canvas element is focusable and can be navigated to using the keyboard.
User Controls
- Implement play/pause and stop controls for the animation.
- Allow users to adjust animation speed or disable autoplay.
Seizures and Physical Reactions
- Avoid rapid flashing elements in animations (no more than three flashes per second).
Input Modalities
- Ensure any visible labels on controls match their accessible names.
3. Understandable
Labels and Instructions
- Clearly label any interactive elements in the animation.
- Provide clear instructions for user interaction with the animation.
4. Robust
Compatibility
- Ensure all interactive elements have appropriate ARIA roles and properties.
- Use the appropriate ARIA role for the canvas element (e.g.,
role="img"
).
Implementation Example
Additional Considerations
- Provide alternatives for users who prefer reduced motion.
- Ensure that the animation doesn’t auto-play if the user has set their system preferences to reduce motion.
- Consider providing a static image alternative for users who cannot or prefer not to view animations.
- Regularly test with assistive technologies to ensure compatibility and proper functioning.
By following these best practices, you can significantly improve the accessibility of your Lottie animations and work towards WCAG 2.1 compliance.
Voluntary Product Accessibility Template (VPAT)
WCAG 2.1 Report
Table 1: Success Criteria, Level A
Criteria | Conformance Level | Remarks and Explanations |
---|---|---|
1.1.1 Non-text Content (Level A) | Supports | Text alternatives are provided for Lottie animations. |
1.2.1 Audio-only and Video-only (Prerecorded) (Level A) | Not Applicable | Lottie animations do not include audio. |
1.2.2 Captions (Prerecorded) (Level A) | Not Applicable | Lottie animations do not include audio. |
1.2.3 Audio Description or Media Alternative (Prerecorded) (Level A) | Supports | Text descriptions of animations can be provided. |
1.3.1 Info and Relationships (Level A) | Supports | Proper markup techniques are used to structure content. |
1.3.2 Meaningful Sequence (Level A) | Supports | Content is presented in a meaningful order. |
1.3.3 Sensory Characteristics (Level A) | Supports | Instructions are not reliant on a single sensory ability. |
1.4.1 Use of Color (Level A) | Supports | Color is not used as the sole means of conveying information. |
1.4.2 Audio Control (Level A) | Not Applicable | Lottie animations do not include audio. |
2.1.1 Keyboard (Level A) | Supports | All functionality is operable through a keyboard interface. |
2.1.2 No Keyboard Trap (Level A) | Supports | Keyboard focus can be moved to and from components. |
2.1.4 Character Key Shortcuts (Level A 2.1 only) | Not Applicable | No character key shortcuts are implemented. |
2.2.1 Timing Adjustable (Level A) | Supports | Users can control animation playback. |
2.2.2 Pause, Stop, Hide (Level A) | Supports | Controls to pause, stop, or hide animations are provided. |
2.3.1 Three Flashes or Below Threshold (Level A) | Supports | Animations do not contain rapid flashing elements. |
2.4.1 Bypass Blocks (Level A) | Not Applicable | Lottie player does not include blocks of repeated content. |
2.4.2 Page Titled (Level A) | Not Applicable | Lottie player is a component, not a full page. |
2.4.3 Focus Order (Level A) | Supports | Focus order is logical and preserves meaning. |
2.4.4 Link Purpose (In Context) (Level A) | Not Applicable | Lottie animations typically do not include links. |
2.5.1 Pointer Gestures (Level A 2.1 only) | Not Applicable | No multi-point or path-based gestures are required. |
2.5.2 Pointer Cancellation (Level A 2.1 only) | Supports | Functions are completed on the up-event. |
2.5.3 Label in Name (Level A 2.1 only) | Supports | Visible labels match their accessible names. |
2.5.4 Motion Actuation (Level A 2.1 only) | Not Applicable | Functionality does not require device motion or user motion. |
3.1.1 Language of Page (Level A) | Not Applicable | Lottie player is a component, not a full page. |
3.2.1 On Focus (Level A) | Supports | Context does not change on focus alone. |
3.2.2 On Input (Level A) | Supports | Context does not change on input alone. |
3.3.1 Error Identification (Level A) | Not Applicable | Lottie player does not involve form submission. |
3.3.2 Labels or Instructions (Level A) | Supports | Labels are provided for user interface elements. |
4.1.1 Parsing (Level A) | Supports | HTML is well-formed and free of significant errors. |
4.1.2 Name, Role, Value (Level A) | Supports | Names, roles, and values can be programmatically determined. |
Table 2: Success Criteria, Level AA
Criteria | Conformance Level | Remarks and Explanations |
---|---|---|
1.2.4 Captions (Live) (Level AA) | Not Applicable | Lottie animations do not include live audio. |
1.2.5 Audio Description (Prerecorded) (Level AA) | Not Applicable | Lottie animations do not include audio tracks. |
1.3.4 Orientation (Level AA 2.1 only) | Supports | Content is not restricted to a single display orientation. |
1.3.5 Identify Input Purpose (Level AA 2.1 only) | Not Applicable | Lottie player does not collect user information. |
1.4.3 Contrast (Minimum) (Level AA) | Supports | Sufficient contrast is ensured for text in animations. |
1.4.4 Resize text (Level AA) | Supports | Text can be resized without loss of content or functionality. |
1.4.5 Images of Text (Level AA) | Not Applicable | Lottie animations typically do not include images of text. |
1.4.10 Reflow (Level AA 2.1 only) | Supports | Content can reflow without loss of information. |
1.4.11 Non-text Contrast (Level AA 2.1 only) | Supports | Visual information used to indicate states has sufficient contrast. |
1.4.12 Text Spacing (Level AA 2.1 only) | Not Applicable | Lottie animations typically do not include blocks of text. |
1.4.13 Content on Hover or Focus (Level AA 2.1 only) | Supports | Additional content appearing on hover or focus is dismissible. |
2.4.5 Multiple Ways (Level AA) | Not Applicable | Lottie player is a component, not a full website. |
2.4.6 Headings and Labels (Level AA) | Supports | Headings and labels are clear and descriptive. |
2.4.7 Focus Visible (Level AA) | Supports | Keyboard focus indicator is visible. |
3.1.2 Language of Parts (Level AA) | Not Applicable | Lottie animations typically do not include language changes. |
3.2.3 Consistent Navigation (Level AA) | Not Applicable | Lottie player is a component, not a full website. |
3.2.4 Consistent Identification (Level AA) | Supports | Components with the same functionality are identified consistently. |
3.3.3 Error Suggestion (Level AA) | Not Applicable | Lottie player does not involve form submission. |
3.3.4 Error Prevention (Legal, Financial, Data) (Level AA) | Not Applicable | Lottie player does not process legal or financial transactions. |
4.1.3 Status Messages (Level AA 2.1 only) | Supports | Status messages can be programmatically determined. |
This VPAT provides an overview of the accessibility compliance of the Lottie player component. It’s important to note that the actual compliance may vary depending on the specific implementation and content of the Lottie animations.