Accessibility
Calcite Components leverage the W3C Accessibility Standards to ensure the applications and experiences you create are usable by a wide range of audiences.
While Calcite is created with accessibility in mind, there are additional steps you can take to ensure a diverse audience can navigate, understand, and use the solutions you build.
Principles
The Web Content Accessibility Guidelines (WCAG) are internationally agreed upon standards established to help create accessible experiences.
The four principles of web accessibility include:
Perceivable
Information and user interface components must be presentable in a way that they can be distinguished.
Operable
User interface components and navigation need to be used by everyone, including those who do not navigate the web using a standard keyboard and mouse.
Understandable
Information and the operation of the user interface must be clear to all users.
Robust
Content must support and be accessed by various user agents, including assistive technologies.
Hierarchy
To facilitate navigation and understanding of overall document structure, use heading elements that are properly ordered or nested (h1, h2, h3, h4, h5, and h6). Heading elements allow user agents to automatically identify section headings.
For example, if the page includes h1
and h2
tags, when designing a calcite-modal
you could use a h2
or h3
tag in the modal's title:
In the same scenario, you should not assign a h4
, or higher tag to the calcite-modal
title, as the page would not have a designated h3
tag established. The skipped header makes it seem like the user has missed hidden content, which, in effect, creates a usability problem.
Keyboard Operability
Similar to heading elements, content should have the same functional and visual order using HTML. When adding multiple elements throughout the page, ensure the HTML matches with the intent.
For example, to ensure content residing in the calcite-switch
is accessed by keyboard and visual users in the same hierarchy, the HTML should reflect the same order. First by declaring the calcite-label
, next the calcite-switch
, and finally the view
.
Focus
Keyboard focus refers to the element receiving keyboard input. Exactly one element is able to have focus at a time. In most browsers, users can move focus by pressing the Tab
key to step forward and the Shift
and Tab
keys to step back.
For an otherwise unfocusable element to become focusable, such as a div
, it must contain a tabindex attribute. A page's focus order must preserve it's meaning and promote ease of use. Focus order should be logical, and generally follow the visual order of the page.
Content
The page's reading order should have a logical structure. To check the reading order, follow the focus commands using the Tab
key to step forward and the Shift
and Tab
keys to step back. The order should have the same flow as seen visually, particularly with forms and search dialogs.
Content on the page should be clear and concise using plain language, without any use of jargon or undefined acronyms. Line length, either too short or too long can be confusing to both sighted and non-sighted users. Ensure text content is concise, yet distinguishable.
Alternative text (Alt text)
When adding images to content, leverage alt text to provide a description to the image presented. Be succinct, while also descriptive, to provide context to non-visual users.
Forms and labels
When working with forms for readability and to assist non-visual users, you must add labels explicitly to associate text with form elements. Calcite has implemented calcite-label
to add labels to form elements. For example: