UNPKG

apex4x

Version:

The Comprehensive ARIA Development Suite

293 lines (261 loc) 9.95 kB
<!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>ARIA Radios - Apex 4X Technical Style Guide</title> <meta name="description" content="Scalable ARIA Components" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="../_common/_doc_files/css/global.css" /> <link rel="stylesheet" type="text/css" href="../_common/_doc_files/prism.css" /> <link rel="stylesheet" type="text/css" href="../_common/_doc_files/css/components-style.css" /> <script src="../_common/_doc_files/prism.js"></script> </head> <body> <div class="outer-wrapper"> <header class="header"> <div class="logo"> <a href="https://whatsock.com"> <img alt="WhatSock : Changing the world one step at a time" src="/Templates/_common/_doc_files/img/whatsock.svg" /> </a> </div> </header> <div class="wrapper"> <main id="main" class="main"> <h1><strong>ARIA Radios</strong></h1> <nav class="navigation--parent"> <p> <a href="/Tutorials/Beginner-Introduction.htm" >Beginner Tutorial</a > </p> <h2 class="parent--page">Template Examples</h2> <ul> <li><a href="../index.htm">Back to Components</a></li> <li><a href="Standard/index.htm">Standard</a></li> </ul> </nav> <section class="section--instructions"> <h2>Expected behaviors</h2> <p> The radio should be focusable using the keyboard, and toggle its checkable state when arrowing between other radios within the same group or when pressing the Spacebar or Enter key. Multiple radios within the same group should have only one tab stop. </p> <p> The 4X ARIA Radio module automatically configures all required ARIA attributes and focus handling, in strict accordance with the ARIA specification. </p> <p> The following attributes are handled automatically by the Radio module: </p> <ul> <li>role=radiogroup</li> <li>role=radio</li> <li>aria-checked</li> <li>tabindex</li> </ul> <p>Available attributes for radio elements:</p> <ul> <li> data-radio : May be set to "false" or "true" to set the current state of a checkable control when rendered. </li> <li> aria-disabled : When set to "true" on the triggering element, will automatically disable associated functionality. </li> </ul> <p> Note: When dynamically disabling a triggering element, the 4X setDisabled() function should be used to set the disabled state of the triggering element. This will ensure proper background mapping. </p> <div> <pre><code class="language-javascript"> $A.setDisabled(triggeringElement, boolean); </code></pre> </div> <h2>HTML syntax</h2> <h3>Standard Unchecked</h3> <div> <pre><code class="language-markup">&lt;div data-radio > Markup with radio name &lt;input hidden type="radio" name="OptionalBoundRadio" /> &lt;/div></code></pre> </div> <h3>Standard Checked</h3> <div> <pre><code class="language-markup">&lt;div data-radio="true" > Markup with radio name &lt;input checked hidden type="radio" name="OptionalBoundRadio" /> &lt;/div></code></pre> </div> <p> IMPORTANT: The focusable active element must not include any other exposed active elements, otherwise these will not be accessible to non-sighted screen reader users. </p> <p> Whenever a hidden checkbox is embedded within the simulated control, it will automatically reflect the toggled state of the parent element. This makes it possible to implement custom toggle controls that can be submitted in the same manner as native form controls. This, however, is optional, and may be removed without having any negative impact on the functionality of the simulated toggle control. </p> <h2>JavaScript syntax</h2> <div> <pre><code class="language-javascript">$A.setRadio( domNodeOrCSSSelectorForTriggeringElements , { // Configure functionality key / value mappings });</code></pre> </div> <ul> <li>Module file: Button.js</li> <li>Requires: AccName.js, RovingTabIndex.js.</li> <li>Recommended: Velocity.js, VelocityUI.js.</li> </ul> <h2>Parameters</h2> <ol> <li> A DOM element or CSS selector to specify the triggering elements </li> <li>A configuration map to customize behaviors and options</li> </ol> <h3 tabindex="-1" id="configure">Configuration</h3> <div> <pre><code class="language-javascript">{ // Set an explicit name for the radio. // If undefined, the accessible name will default to the text content within the radio element. label: "My informative radio label", // Specify if the radio is required. // If a native radio element is specified, this property will automatically be set to match the radio element's 'required' property. required: false, // Specify if the radio is disabled. // If a native radio element is specified, this property will automatically be set to match the radio element's 'disabled' property. disabled: false, // Set the class to be applied when a radio is toggled. // If undefined, "checked" will be set by default. toggleClassName: "checked", // Set a custom event handler to process every time a radio is activated. onActivate: function(ev, triggerNode, boundRadio, checked, set) { // 'checked' reflects the current attribute value for the checkable item, and is always a number if applicable. // if 0, the checked state is "false". // if 1, the checked state is "true". // The 'set' argument is a function that will set the checkable item to a new state. // The new value must be a string consisting of "false" or "true". set("true"); ev.preventDefault(); } }</code></pre> </div> </section> </main> </div> <footer class="footer"> <div class="flex-container-row"> <div class="flex-item"> <h2>License</h2> <p> Apex 4X including all template design patterns is distributed under the terms of the Open Source Initiative OSI - MIT License, and may be freely used for any purpose within any web technology. </p> </div> <div class="flex-item"> <h2>Resources</h2> <ul> <li> <a target="ext" href="https://github.com/WhatSock/apex" >Apex 4X on GitHub</a > </li> <li> <a target="ext" href="https://whatsock.github.io/visual-aria/github-bookmarklet/visual-aria.htm" >Visual ARIA Bookmarklet</a > </li> <li> <a target="ext" href="https://chrome.google.com/webstore/detail/visual-aria/lhbmajchkkmakajkjenkchhnhbadmhmk" >Visual ARIA Chrome Extension</a > </li> <li> <a target="ext" href="https://addons.mozilla.org/en-US/firefox/addon/visual-aria/" >Visual ARIA Firefox Extension</a > </li> <li> <a target="ext" href="https://github.com/AccDC/visual-aria" >Visual ARIA on GitHub</a > </li> <li> <a target="ext" href="https://whatsock.com/training/matrices/" >ARIA Role Conformance Matrices</a > </li> <li> <a target="ext" href="https://whatsock.com/training/" >Accessibility Tree Training Guide</a > </li> </ul> </div> <div class="flex-item"> <h2>Acknowledgements</h2> <ul class="list--horizontal"> <li> Author and developer: <a target="ext" href="https://www.linkedin.com/in/bgaraventa" >Bryan Garaventa</a > </li> <li> Website designer: <a target="ext" href="https://gericci.me/">Angela Ricci</a> </li> <li> Style and markup editor: <a target="ext" href="https://www.linkedin.com/in/laurence-lewis-77520365/" >Laurence Lewis</a > </li> </ul> </div> </div> </footer> </div> </body> <script async src="https://api.whatsock.com/accdc-updates.js?4x=template" ></script> </html>