55 * @name ngAria
66 * @description
77 *
8- * The `ngAria` module provides support for adding <abbr title="Accessible Rich Internet Applications">ARIA</abbr>
9- * attributes that convey state or semantic information about the application in order to allow assistive technologies
10- * to convey appropriate information to persons with disabilities.
8+ * The `ngAria` module provides support for common
9+ * [<abbr title="Accessible Rich Internet Applications">ARIA</abbr>](http://www.w3.org/TR/wai-aria/)
10+ * attributes that convey state or semantic information about the application for users
11+ * of assistive technologies, such as screen readers.
1112 *
1213 * <div doc-module-components="ngAria"></div>
1314 *
14- * # Usage
15- * To enable the addition of the ARIA tags, just require the module into your application and the tags will
16- * hook into your ng-show/ng-hide, input, textarea, button, select and ng-required directives and adds the
17- * appropriate ARIA attributes.
15+ * ## Usage
1816 *
19- * Currently, the following ARIA attributes are implemented:
17+ * For ngAria to do its magic, simply include the module as a dependency. The directives supported
18+ * by ngAria are:
19+ * `ngModel`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, `ngDblClick`, and `ngMessages`.
2020 *
21- * + aria-hidden
22- * + aria-checked
23- * + aria-disabled
24- * + aria-required
25- * + aria-invalid
26- * + aria-multiline
27- * + aria-valuenow
28- * + aria-valuemin
29- * + aria-valuemax
30- * + tabindex
21+ * Below is a more detailed breakdown of the attributes handled by ngAria:
3122 *
32- * You can disable individual ARIA attributes by using the {@link ngAria.$ariaProvider#config config} method.
23+ * | Directive | Supported Attributes |
24+ * |---------------------------------------------|----------------------------------------------------------------------------------------|
25+ * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required |
26+ * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
27+ * | {@link ng.directive:ngShow ngShow} | aria-hidden |
28+ * | {@link ng.directive:ngHide ngHide} | aria-hidden |
29+ * | {@link ng.directive:ngClick ngClick} | tabindex |
30+ * | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
31+ * | {@link module:ngMessages ngMessages} | aria-live |
32+ *
33+ * Find out more information about each directive by reading the
34+ * {@link guide/accessibility ngAria Developer Guide}.
35+ *
36+ *
37+ * ###Disabling Attibutes
38+ * It's possible to disable individual attributes added by ngAria with the
39+ * {@link ngAria.$ariaProvider#config config} method.
3340 */
34-
3541 /* global -ngAriaModule */
3642var ngAriaModule = angular . module ( 'ngAria' , [ 'ng' ] ) .
3743 provider ( '$aria' , $AriaProvider ) ;
@@ -42,10 +48,20 @@ var ngAriaModule = angular.module('ngAria', ['ng']).
4248 *
4349 * @description
4450 *
45- * Used for configuring ARIA attributes.
51+ * Used for configuring the ARIA attributes injected and managed by ngAria.
52+ *
53+ * ```js
54+ * angular.module('myApp', ['ngAria'], function config($ariaProvider) {
55+ * $ariaProvider.config({
56+ * ariaValue: true,
57+ * tabindex: false
58+ * });
59+ * });
60+ *```
4661 *
4762 * ## Dependencies
4863 * Requires the {@link ngAria} module to be installed.
64+ *
4965 */
5066function $AriaProvider ( ) {
5167 var config = {
@@ -108,7 +124,41 @@ function $AriaProvider() {
108124 *
109125 * @description
110126 *
111- * Contains helper methods for applying ARIA attributes to HTML
127+ * The $aria service contains helper methods for applying common
128+ * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
129+ *
130+ * ngAria injects common accessibility attributes that tell assistive technologies when HTML
131+ * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria,
132+ * let's review a code snippet from ngAria itself:
133+ *
134+ *```js
135+ * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
136+ * return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
137+ * }])
138+ *```
139+ * Shown above, the ngAria module creates a directive with the same signature as the
140+ * traditional `ng-disabled` directive. But this ngAria version is dedicated to
141+ * solely managing accessibility attributes. The internal `$aria` service is used to watch the
142+ * boolean attribute `ngDisabled`. If it has not been explicitly set by the developer,
143+ * `aria-disabled` is injected as an attribute with its value synchronized to the value in
144+ * `ngDisabled`.
145+ *
146+ * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do
147+ * anything to enable this feature. The `aria-disabled` attribute is automatically managed
148+ * simply as a silent side-effect of using `ng-disabled` with the ngAria module.
149+ *
150+ * The full list of directives that interface with ngAria:
151+ * * **ngModel**
152+ * * **ngShow**
153+ * * **ngHide**
154+ * * **ngClick**
155+ * * **ngDblclick**
156+ * * **ngMessages**
157+ * * **ngDisabled**
158+ *
159+ * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each
160+ * directive.
161+ *
112162 *
113163 * ## Dependencies
114164 * Requires the {@link ngAria} module to be installed.
0 commit comments