From ea7b05ed69807f939f4fd57ff6762f5128ebc21d Mon Sep 17 00:00:00 2001 From: Erin Donehoo Date: Wed, 11 Oct 2023 11:11:31 -0400 Subject: [PATCH 01/15] docs(accessibility-testing): Updates content as part of content audit. --- .../accessibility-testing.md | 109 +++++++++--------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/packages/documentation-site/patternfly-docs/content/developer-resources/accessibility-testing.md b/packages/documentation-site/patternfly-docs/content/developer-resources/accessibility-testing.md index 9f923719ef..f38a7ebef3 100644 --- a/packages/documentation-site/patternfly-docs/content/developer-resources/accessibility-testing.md +++ b/packages/documentation-site/patternfly-docs/content/developer-resources/accessibility-testing.md @@ -3,83 +3,79 @@ id: Testing your accessibility section: accessibility --- -## General testing +# Testing your product's accessibility -Many accessibility issues can be found by doing a few simple checks: - -1. **Validate your HTML.** Structural, semantic HTML is the key starting point toward good accessibility practices. When a screen reader (or any sort of assistive device) scans a web page, it gets information about the Document Object Model (DOM), or the HTML structure of the page. No styles or JavaScript will be read by a screen reader. - - - Screen reader software like Voice Over, NVDA, or JAWS doesn’t just turn text into speech. It can use information in the HTML to list all of the headings on a page, give extra navigation controls to data tables, or announce how many items are in a list, among other things. This makes semantic HTML essential. - - - There are many tools you can use to validate your HTML, such as [W3C’s markup validation service](https://validator.w3.org/). - - -2. **Use an accessibility audit tool to check for violations.** If you are using PatternFly in your project, we recommend using [aXe: The Accessibility Engine](//www.deque.com/axe/) to check for accessibility violations locally. To make it even easier for you, we've created the [patternfly-a11y script](https://github.com/patternfly/patternfly-a11y) which reports any axe accessibility violations from a set of pages. A configuration file can be set to customize to specific needs like authentication, waiting for any specific items to finish loading (like a loading spinner), etc. When used as a report, it will give an output [similar to this example](http://a11y-os.surge.sh/). The UI should be built first in the CI workflow and then a job created to run the a11y script against that build. The a11y script assumes that there is a webserver running somewhere that is serving up the pages, i.e. in localhost:8000, that it can reach. If you want to test a step before deployment, you could follow the path of integrating axe with cypress. If you are contributing to PatternFly, refer to our [README.md](//github.com/patternfly/patternfly/blob/main/README.md#testing-for-accessibility) on how to run this tool. - - -3. **Test keyboard accessibility, and check that these requirements are met:** - - All functionality is keyboard accessible. - - Elements in the HTML and in the layout follow a logical order. - - Elements with focus are clearly visible. +The following guide contains instructions and recommendations to comprehensively test your product's accessibility to identify accessibility issues and opportunities for improvement. +## General testing recommendations -4. **Disable styles**, then test the information architecture and presence of adequate text labels. The [WAVE browser extension from WebAIM](//wave.webaim.org/extension/) provides this feature if it isn't available in the browser you are using. +Many accessibility issues can be found by doing a few simple checks: +### 1. Validate your HTML -5. **Test with any screen reader available in your operating system.** We target these screen readers to test PatternFly: - - JAWS with Chrome, Windows ([JAWS keyboard shortcuts](//dequeuniversity.com/screenreaders/jaws-keyboard-shortcuts)) - - Voiceover with Safari, Mac ([Voiceover keyboard shortcuts](//dequeuniversity.com/screenreaders/voiceover-keyboard-shortcuts)) - - NVDA with Firefox, Windows ([NVDA keyboard shortcuts](//dequeuniversity.com/screenreaders/nvda-keyboard-shortcuts)) +Good accessibility practices start with structural, semantic HTML. When a screen reader (or any sort of assistive device) scans a web page, it gets information about the Document Object Model (DOM), or the HTML structure of the page. No styles or JavaScript will be read by a screen reader. +Screen reader software like Voice Over (VO), NVDA, or JAWS doesn’t just turn text into speech. It can use information in the HTML to list all of the headings on a page, give extra navigation controls to data tables, announce how many items are in a list, and more. This makes semantic HTML essential. +There are many tools you can use to validate your HTML, such as [W3C’s markup validation service](https://validator.w3.org/). -6. **Check color contrast for the following:** - - Text color against background color ([Understanding WCAG 1.4.3](//www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html)) - - Text color against link color ([Technique G183](//www.w3.org/TR/WCAG20-TECHS/G183.html)) - - Visible boundaries of buttons and form elements against adjacent background color ([Understanding WCAG 1.4.11](//www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html)) +### 2. Check for accessibility violations with an audit tool + If you are using PatternFly, we recommend using [aXe: The Accessibility Engine](//www.deque.com/axe/) to check for accessibility violations locally. To make it even easier for you, we've created the [patternfly-a11y script](https://github.com/patternfly/patternfly-a11y), which reports any aXe accessibility violations from a set of pages. + + To use this script, a configuration file can be set to adapt our script to your specific needs like authentication, waiting for any specific items to finish loading (like a loading spinner), etc. + + When used as a report, it will give an output [similar to this example](http://a11y-os.surge.sh/). The UI should be built first in the CI workflow and then a job created to run the a11y script against that build. The a11y script assumes that there is a webserver running somewhere that is serving up the pages, i.e. in localhost:8000, that it can reach. If you want to test a step before deployment, you could follow the path of integrating axe with cypress. If you are contributing to PatternFly, refer to our [README.md](//github.com/patternfly/patternfly/blob/main/README.md#testing-for-accessibility) on how to run this tool. -## Screen readers -Just as front-end developers use their browser to see how their changes look, you should use a screen reader to see how your accessibility looks (we use Voice Over). +### 3. Test keyboard accessibility -Generally, screen readers access the DOM (Document Object Model), and they use browser APIs (Application Programming Interfaces) to get the information they need. In this way, a screen reader knows what to say when a set of list items begins and ends, and it typically announces, in advance, how many items are in the list. A screen reader can also traverse a page using heading navigation to speak the heading level. +Because the keyboard is a key accessibility tool, it is necessary to ensure that the following requirements are met: -Here are a few aspects that can affect how screen readers communicate information: + - All functionality is keyboard accessible. + - Elements in the HTML and in the layout follow a logical order. + - Elements with focus are clearly visible. -- **Semantic HTML**: Semantics refers to the meaning of a piece of code. A semantic element clearly describes its meaning to both the browser and the developer. For example, `
` and `` are non-semantic elements because they don't describe their contents. Examples of semantic elements include `
` and ``, which clearly define their contents. Screen readers expect semantic HTML when traversing the DOM, so non-semantic elements that aren't customized to be made accessible are highly likely to be inaccessible. Aria and other accessible attributes are meant to extend the functionality and meaning of native semantics, but at the core, your HTML should be semantic. +### 4. Test without styles -- **Headings**: A visual user can scan a page and fairly quickly understand its information architecture. Visually impaired users have other methods of achieving this. One common method is using heading levels to determine the flow of information. Headings that vary in size simply based on design and not functionality will likely confuse these users. A clear flow of sequential heading sizes based on headings and subheadings is significantly clearer to all users. +Because screen readers cannot access style information, you should disable styles for your product and ensure that your information architecture is effective and that there are adequate text labels. -- **Accessible names for all elements**: When an element doesn't have visual text or when further explanation is necessary, a screen reader will not know what an item is or does. For example, if you have an icon `