@@ -23,9 +23,9 @@ angular.module('myApp', ['ngAria'])...
2323###Using ngAria
2424Most of what ngAria does is only visible "under the hood". To see the module in action, once you've
2525added it as a dependency, you can test a few things:
26- * Using your favorite element inspector, look for ngAria attributes in your own code.
26+ * Using your favorite element inspector, look for attributes added by ngAria in your own code.
2727 * Test using your keyboard to ensure `tabindex` is used correctly.
28- * Fire up a screen reader such as VoiceOver to listen for ARIA support.
28+ * Fire up a screen reader such as VoiceOver or NVDA to check for ARIA support.
2929[Helpful screen reader tips.](http://webaim.org/articles/screenreader_testing/)
3030
3131##Supported directives
@@ -41,8 +41,8 @@ Currently, ngAria interfaces with the following directives:
4141
4242<h2 id="ngmodel">ngModel</h2>
4343
44- Most of ngAria's heavy lifting happens in the {@link ngModel ngModel}
45- directive. For elements using ngModel, special attention is paid by ngAria if that element also
44+ Much of ngAria's heavy lifting happens in the {@link ngModel ngModel}
45+ directive. For elements using ngModel, special attention is paid by ngAria if that element also
4646has a role or type of `checkbox`, `radio`, `range` or `textbox`.
4747
4848For those elements using ngModel, ngAria will dynamically bind and update the following ARIA
@@ -134,10 +134,8 @@ attributes (if they have not been explicitly specified by the developer):
134134
135135ngAria will also add `tabIndex`, ensuring custom elements with these roles will be reachable from
136136the keyboard. It is still up to **you** as a developer to **ensure custom controls will be
137- operable** from the keybard. Think of `ng-click` on a `<div>` or `<md-checkbox>`: you still need
138- to bind `ng-keypress` to make it fully operable from the keyboard. As a rule, any time you create
139- a widget involving user interaction, be sure to test it with your keyboard and at least one mobile
140- and desktop screen reader (preferably more).
137+ accessible**. As a rule, any time you create a widget involving user interaction, be sure to test
138+ it with your keyboard and at least one mobile and desktop screen reader.
141139
142140<h2 id="ngdisabled">ngDisabled</h2>
143141
@@ -160,7 +158,7 @@ Becomes:
160158```
161159
162160>You can check whether a control is legitimately disabled for a screen reader by visiting
163- [chrome://accessibility](chrome://accessibility).
161+ [chrome://accessibility](chrome://accessibility) and inspecting [the accessibility tree](http://www.paciellogroup.com/blog/2015/01/the-browser-accessibility-tree/) .
164162
165163<h2 id="ngshow">ngShow</h2>
166164
@@ -210,16 +208,25 @@ The default CSS for `ngHide`, the inverse method to `ngShow`, makes ngAria redun
210208`display: none`. See explanation for {@link guide/accessibility#ngshow ngShow} when overriding the default CSS.
211209
212210<h2><span id="ngclick">ngClick</span> and <span id="ngdblclick">ngDblclick</span></h2>
213- If `ng-click` or `ng-dblclick` is encountered, ngAria will add `tabindex="0"` if it isn't there
214- already.
211+ If `ng-click` or `ng-dblclick` is encountered, ngAria will add `tabindex="0"` to any element not in
212+ a node blacklist:
215213
216- To fix widespread accessibility problems with `ng-click` on div elements, ngAria will dynamically
217- bind keypress by default as long as the element isn't an anchor, button, input or textarea.
218- You can turn this functionality on or off with the `bindKeypress` configuration option. ngAria
219- will also add the `button` role to communicate to users of assistive technologies.
214+ * Button
215+ * Anchor
216+ * Input
217+ * Textarea
218+ * Select
219+ * Details/Summary
220220
221- For `ng-dblclick`, you must still manually add `ng-keypress` and role to non-interactive elements such
222- as `div` or `taco-button` to enable keyboard access.
221+ To fix widespread accessibility problems with `ng-click` on `div` elements, ngAria will
222+ dynamically bind a keypress event by default as long as the element isn't in the node blacklist.
223+ You can turn this functionality on or off with the `bindKeypress` configuration option.
224+
225+ ngAria will also add the `button` role to communicate to users of assistive technologies. This can
226+ be disabled with the `bindRoleForClick` configuration option.
227+
228+ For `ng-dblclick`, you must still manually add `ng-keypress` and a role to non-interactive elements
229+ such as `div` or `taco-button` to enable keyboard access.
223230
224231<h3>Example</h3>
225232```html
@@ -260,62 +267,18 @@ The attribute magic of ngAria may not work for every scenario. To disable indivi
260267you can use the {@link ngAria.$ariaProvider#config config} method. Just keep in mind this will
261268tell ngAria to ignore the attribute globally.
262269
263- <example module="ngAria_ngDisabledExample " deps="angular-aria.js">
270+ <example module="ngAria_ngClickExample " deps="angular-aria.js">
264271 <file name="index.html">
265- <style>
266- [role=checkbox] {
267- cursor: pointer;
268- display: inline-block;
269- }
270- [role=checkbox] .icon:before {
271- content: '\2610';
272- display: inline-block;
273- font-size: 2em;
274- line-height: 1;
275- vertical-align: middle;
276- speak: none;
277- }
278- [role=checkbox].active .icon:before {
279- content: '\2611';
280- }
281- </style>
282- <form ng-controller="formsController">
283- <div ng-model="someModel" show-attrs>
284- Div with ngModel and aria-invalid disabled
285- </div>
286- <div role="checkbox" ng-model="checked" ng-class="{active: checked}"
287- aria-label="Custom Checkbox" ng-click="toggleCheckbox()" some-checkbox show-attrs>
288- <span class="icon" aria-hidden="true"></span>
289- Custom Checkbox for comparison
272+ <div ng-click="someFunction" show-attrs>
273+ <div> with ng-click and bindRoleForClick, tabindex set to false
290274 </div>
291- </form>
292275 <script>
293- angular.module('ngAria_ngDisabledExample ', ['ngAria'], function config($ariaProvider) {
276+ angular.module('ngAria_ngClickExample ', ['ngAria'], function config($ariaProvider) {
294277 $ariaProvider.config({
295- ariaInvalid : false,
296- tabindex: true
278+ bindRoleForClick : false,
279+ tabindex: false
297280 });
298281 })
299- .controller('formsController', function($scope){
300- $scope.checked = false;
301- $scope.toggleCheckbox = function(){
302- $scope.checked = !$scope.checked;
303- }
304- })
305- .directive('someCheckbox', function(){
306- return {
307- restrict: 'A',
308- link: function($scope, $el, $attrs) {
309- $el.on('keypress', function(event){
310- event.preventDefault();
311- if(event.keyCode === 32 || event.keyCode === 13){
312- $scope.toggleCheckbox();
313- $scope.$apply();
314- }
315- });
316- }
317- }
318- })
319282 .directive('showAttrs', function() {
320283 return function(scope, el, attrs) {
321284 var pre = document.createElement('pre');
0 commit comments