fixup! fix(ngAria.ngClick): restrict preventDefault on space / enter to non-interactive elements

This commit is contained in:
Martin Staffa
2018-09-05 19:33:33 +02:00
parent 190bc1d52b
commit 30ab202fa7
2 changed files with 3 additions and 7 deletions
+2 -2
View File
@@ -389,9 +389,9 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
var keyCode = event.which || event.keyCode;
if (keyCode === 13 || keyCode === 32) {
// Prevent the default browser behavior (e.g. scrolling when pressing spacebar) ...
// If the event is triggered on a non-interactive element ...
if (nodeBlackList.indexOf(event.target.nodeName) === -1) {
// ... but only when the event is triggered by a non-interactive element
// ... prevent the default browser behavior (e.g. scrolling when pressing spacebar)
// See https://github.com/angular/angular.js/issues/16664
event.preventDefault();
}
+1 -5
View File
@@ -957,11 +957,7 @@ describe('$aria', function() {
they('should not prevent default keyboard action if an interactive $type element' +
'is nested inside ng-click', nodeBlackList, function(elementType) {
function createHTML(type) {
var html = '<' + type + '>';
if (type === 'INPUT' || 'TYPE' === 'A') return html;
return html + '</' + type + '>';
return '<' + type + '></' + type + '>';
}
compileElement(