11/**
2- * @license AngularJS v1.5.8
3- * (c) 2010-2016 Google, Inc. http://angularjs.org
2+ * @license AngularJS v1.6.4
3+ * (c) 2010-2017 Google, Inc. http://angularjs.org
44 * License: MIT
55 */
66( function ( window , angular ) { 'use strict' ;
2626 *
2727 * Below is a more detailed breakdown of the attributes handled by ngAria:
2828 *
29- * | Directive | Supported Attributes |
30- * |---------------------------------------------|----------------------------------------------------------------------------------------|
29+ * | Directive | Supported Attributes |
30+ * |---------------------------------------------|----------------------------------------------------------------------------------------------------- |
3131 * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
32- * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
33- * | {@link ng.directive:ngRequired ngRequired} | aria-required
34- * | {@link ng.directive:ngChecked ngChecked} | aria-checked
35- * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly |
36- * | {@link ng.directive:ngValue ngValue} | aria-checked |
37- * | {@link ng.directive:ngShow ngShow} | aria-hidden |
38- * | {@link ng.directive:ngHide ngHide} | aria-hidden |
39- * | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
40- * | {@link module:ngMessages ngMessages} | aria-live |
41- * | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
32+ * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
33+ * | {@link ng.directive:ngRequired ngRequired} | aria-required |
34+ * | {@link ng.directive:ngChecked ngChecked} | aria-checked |
35+ * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly |
36+ * | {@link ng.directive:ngValue ngValue} | aria-checked |
37+ * | {@link ng.directive:ngShow ngShow} | aria-hidden |
38+ * | {@link ng.directive:ngHide ngHide} | aria-hidden |
39+ * | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
40+ * | {@link module:ngMessages ngMessages} | aria-live |
41+ * | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role |
4242 *
4343 * Find out more information about each directive by reading the
4444 * {@link guide/accessibility ngAria Developer Guide}.
5858 * {@link ngAria.$ariaProvider#config config} method. For more details, see the
5959 * {@link guide/accessibility Developer Guide}.
6060 */
61- /* global -ngAriaModule */
6261var ngAriaModule = angular . module ( 'ngAria' , [ 'ng' ] ) .
62+ info ( { angularVersion : '1.6.4' } ) .
6363 provider ( '$aria' , $AriaProvider ) ;
6464
6565/**
@@ -75,6 +75,7 @@ var isNodeOneOf = function(elem, nodeTypeArray) {
7575/**
7676 * @ngdoc provider
7777 * @name $ariaProvider
78+ * @this
7879 *
7980 * @description
8081 *
@@ -103,7 +104,7 @@ function $AriaProvider() {
103104 ariaInvalid : true ,
104105 ariaValue : true ,
105106 tabindex : true ,
106- bindKeypress : true ,
107+ bindKeydown : true ,
107108 bindRoleForClick : true
108109 } ;
109110
@@ -119,12 +120,15 @@ function $AriaProvider() {
119120 * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
120121 * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
121122 * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
122- * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
123+ * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and
124+ * aria-valuenow tags
123125 * - **tabindex** – `{boolean}` – Enables/disables tabindex tags
124- * - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `div` and
125- * `li` elements with ng-click
126- * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements like `div`
127- * using ng-click, making them more accessible to users of assistive technologies
126+ * - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive
127+ * elements (such as `div` or `li`) using ng-click, making them more accessible to users of
128+ * assistive technologies
129+ * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as
130+ * `div` or `li`) using ng-click, making them more accessible to users of assistive
131+ * technologies
128132 *
129133 * @description
130134 * Enables/disables various ARIA attributes
@@ -233,8 +237,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
233237 function shouldAttachRole ( role , elem ) {
234238 // if element does not have role attribute
235239 // AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
236- // AND element is not INPUT
237- return ! elem . attr ( 'role' ) && ( elem . attr ( 'type' ) === role ) && ( elem [ 0 ] . nodeName !== 'INPUT' ) ;
240+ // AND element is not in nodeBlackList
241+ return ! elem . attr ( 'role' ) && ( elem . attr ( 'type' ) === role ) && ! isNodeOneOf ( elem , nodeBlackList ) ;
238242 }
239243
240244 function getShape ( attr , elem ) {
@@ -254,14 +258,6 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
254258 var shape = getShape ( attr , elem ) ;
255259
256260 return {
257- pre : function ( scope , elem , attr , ngModel ) {
258- if ( shape === 'checkbox' ) {
259- //Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
260- ngModel . $isEmpty = function ( value ) {
261- return value === false ;
262- } ;
263- }
264- } ,
265261 post : function ( scope , elem , attr , ngModel ) {
266262 var needsTabIndex = shouldAttachAttr ( 'tabindex' , 'tabindex' , elem , false ) ;
267263
@@ -270,6 +266,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
270266 }
271267
272268 function getRadioReaction ( newVal ) {
269+ // Strict comparison would cause a BC
270+ // eslint-disable-next-line eqeqeq
273271 var boolVal = ( attr . value == ngModel . $viewValue ) ;
274272 elem . attr ( 'aria-checked' , boolVal ) ;
275273 }
@@ -363,7 +361,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
363361 return {
364362 restrict : 'A' ,
365363 compile : function ( elem , attr ) {
366- var fn = $parse ( attr . ngClick , /* interceptorFn */ null , /* expensiveChecks */ true ) ;
364+ var fn = $parse ( attr . ngClick ) ;
367365 return function ( scope , elem , attr ) {
368366
369367 if ( ! isNodeOneOf ( elem , nodeBlackList ) ) {
@@ -376,8 +374,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
376374 elem . attr ( 'tabindex' , 0 ) ;
377375 }
378376
379- if ( $aria . config ( 'bindKeypress ' ) && ! attr . ngKeypress ) {
380- elem . on ( 'keypress ' , function ( event ) {
377+ if ( $aria . config ( 'bindKeydown ' ) && ! attr . ngKeydown && ! attr . ngKeypress && ! attr . ngKeyup ) {
378+ elem . on ( 'keydown ' , function ( event ) {
381379 var keyCode = event . which || event . keyCode ;
382380 if ( keyCode === 32 || keyCode === 13 ) {
383381 scope . $apply ( callback ) ;
0 commit comments