Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30ab202

Browse files
committed
fixup! fix(ngAria.ngClick): restrict preventDefault on space / enter to non-interactive elements
1 parent 190bc1d commit 30ab202

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/ngAria/aria.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
389389
var keyCode = event.which || event.keyCode;
390390

391391
if (keyCode === 13 || keyCode === 32) {
392-
// Prevent the default browser behavior (e.g. scrolling when pressing spacebar) ...
392+
// If the event is triggered on a non-interactive element ...
393393
if (nodeBlackList.indexOf(event.target.nodeName) === -1) {
394-
// ... but only when the event is triggered by a non-interactive element
394+
// ... prevent the default browser behavior (e.g. scrolling when pressing spacebar)
395395
// See https://github.com/angular/angular.js/issues/16664
396396
event.preventDefault();
397397
}

test/ngAria/ariaSpec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,7 @@ describe('$aria', function() {
957957
they('should not prevent default keyboard action if an interactive $type element' +
958958
'is nested inside ng-click', nodeBlackList, function(elementType) {
959959
function createHTML(type) {
960-
var html = '<' + type + '>';
961-
962-
if (type === 'INPUT' || 'TYPE' === 'A') return html;
963-
964-
return html + '</' + type + '>';
960+
return '<' + type + '></' + type + '>';
965961
}
966962

967963
compileElement(

0 commit comments

Comments
 (0)