fixup! fix(ngAria.ngClick): restrict preventDefault on space / enter to non-interactive elements
This commit is contained in:
+2
-2
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user