-
Notifications
You must be signed in to change notification settings - Fork 0
/
disclosure.html
24 lines (24 loc) · 3.59 KB
/
disclosure.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<head>
<title>Simple Accordion</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script src="/javascripts/javascript.js"></script>
</head>
<body>
<h1>Simple Accordion Example</h1>
<p>The link below toggles the expansion/collapse of additional information. This is an example of how to implement such a control in an accessible manner.</p>
<p><strong>Note:</strong> For satisfying <a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-refs.html">WCAG Success Criteria 2.4.4 - Link Purpose (In Context)</a> when meeting WCAG A and AA requirements, the "Show" and "Hide" text would need surrounding context to convey the context of the link. Understanding link purpose out of context through the link text alone is required by <a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-link.html">Success Criteria 2.4.9 - Link Purpose (Link Only)</a>, which is a WCAG level AAA requirement. Most websites and applications strive for WCAG A and AA compliance so this is generally not a requirement.</p>
<p>Concepts included in this example for accessibility:</p>
<ul>
<li>The <a href="https://www.w3.org/TR/wai-aria-1.1/#aria-expanded">aria-expanded</a> state has been added to the link that is expandable/collapsible to convey its state. The state is updated accordingly when the element's state changes.</li>
<li>The <a href="https://www.w3.org/TR/wai-aria-1.1/#aria-controls">aria-controls</a> property has been added to the link that is expandable/collapsible and references the ID of the content toggled by the link.</li>
<li>The CSS display property is updated appropriately when toggling the content to ensure it is properly hidden both visually as well as programmatically to ensure it is not exposed to assistive technology when collapsed and visually hidden.</li>
<li>The <a href="https://www.w3.org/TR/wai-aria-1.1/#region">region</a> role has been applied to the element containing the additional content. This informs users when they are entering/exiting the region of related information. The aria-expanded state is necessary however a region is not required for this type of widget. This is just a proof of concept.</li>
<li>The <a href="https://www.w3.org/TR/wai-aria-1.1/#aria-label">aria-label</a> property has been applied to the region containing the expandable text to name the region. As aforementioned, a region is not necessary for the toggled content. When regions are used, however, they must be labeled to provide accessible names. This facilitates users navigating via regions with a screen reader to identify the regions.</li>
</ul>
<hr />
<a href="#" onclick="togglediv()" aria-expanded="false" aria-controls="#information" id="toggleLink">Show</a>
<p id="information" style="display: none;" role="region" aria-label="Example region with more information">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla massa ante, tincidunt sed eros sit amet, finibus efficitur orci. Etiam a suscipit neque, ac cursus massa. Integer eros orci, porttitor et gravida nec, maximus ut sem. Suspendisse potenti. Nunc metus dui, fermentum ac est sed, ullamcorper pulvinar est. Donec cursus sit amet mauris iaculis aliquet. Vestibulum sit amet mi nec justo malesuada tincidunt. Integer sed bibendum ex, in faucibus ligula. Sed a felis sodales, blandit ante id, iaculis enim. Vestibulum rhoncus dolor arcu, at rutrum libero molestie non. Vivamus scelerisque sapien augue, vitae venenatis enim venenatis ut. Integer in odio eget nisi facilisis consequat. Aliquam bibendum nulla ex, non porttitor neque posuere bibendum. </p>
</body>
</html>