import { CodeSnippet } from '@fluentui/docs-components';
import * as React from 'react';
import DocPage from '../components/DocPage/DocPage';
import GuidesNavigationFooter from '../components/GuidesNavigationFooter';
import { Link } from 'react-router-dom';
import { code, link } from '../utils/helpers';
import { Header } from '@fluentui/react-northstar';
export default () => (
{link('Goals of accessibility', '#goals-of-accessibility')}
{link('Out of scope', '#out-of-scope')}
{link('Making an app / page accessible', '#making-an-app-page-accessible')}
Fluent UI components follow{' '}
{link('WAI-ARIA 1.1 authoring practises', 'https://www.w3.org/TR/wai-aria-practices-1.1/')}. They can be easily
composed into accesible experiences with correct keyboard navigation, screen reader support, high contrast theme
and zooming.
Fluent UI introduces the concept of accessibility behaviors which are responsible for translating the natural
Fluent UI API into correct ARIA roles, attributes and keyboard key handlers. Default behaviors can be overriden
and customized.
The consumer of the library should generally be shielded from the intricates of applying the correct ARIA roles,
testing on multiple screen reader / os combinations. This allows spending more time on the usability aspects of
accessibility.
Following steps help to design an accessible user experience:
decompose UI to parts and identify components, variants and behaviors to use
define usage of{' '}
{link('headings and landmarks', 'https://www.w3.org/TR/wai-aria-practices/examples/landmarks/index.html')}
verify usage of{' '}
{link('color and contrast', 'https://accessibility.umn.edu/core-skills/color-contrast')} to convey
information
define tab order and arrow key navigation
specify labels, especially for components without textual information (icon only buttons) and for
containers (menus, toolbars and so on)
specify texts for state change announcements (number of available items in dropdown, error messages,
confirmations, ...)
identify UI parts that appear on hover or focus and specify keyboard and screen reader interaction with
them
list cases when focus needs to be moved programatically (if parts of the UI are
appearing/disappearing or other cases){' '}
list cases when focus needs to be trapped in sections of the UI (for dialogs and popups or for
hierarchical navigation)
if extending existing functionality, how does it fit into current experience with regards to discoverability,
interaction, keyboard navigation and screen reader navigation?
Internationalization, globalization, keyboard shortcuts and language detection are deliberately not part of Fluent
UI and should be handled by the hosting application.
Besides component level accessibility there are application / page level considerations, mostly regarding the
logical structure. Follow{' '}
{link('ARIA Landmarks Example', 'https://www.w3.org/TR/wai-aria-practices/examples/landmarks/index.html')} to
identify and implement page areas.
In some cases, ARIA attributes need to be provided by the consumer of Fluent UI if the required information cannot
be derived from the components.
Focusable elements that do not contain any textual information need to be labelled so that the screen reader can
present them to the user. In addition to that, information that is relevant to the screen reader user only can be
added to the label:
>
`}
/>
Most typical examples are {code('aria-label')}, {code('aria-labelledby')} and {code('title')} attributes. In some
cases the values need to be dynamically changed based on the state of the component/application.
While Fluent UI goes a long way in making the application accessible by default, it does build on having correct
semantic HTML as the base.
One way to look at this is that by looking at the HTML, you should immediately be able to see what the function is
on every part of the page. For example,
`}
/>
This is a simple example, clearly here the intent is to display a button with an icon labelled 'Download'. HTML
representation is semantically correct and specifies essential
{code('aria-*')} attributes:
`}
/>
Although we highly recommend using semantically correct HTML elements, it is possible to render, for example,{' '}
{code('