Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(ngAria): Announce ngMessages with aria-live #9834

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ngAria/aria.js
Original file line number Diff line number Diff line change
@@ -238,5 +238,16 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
.directive('ngDisabled', ['$aria', function($aria) {
return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
}])
.directive('ngMessages', function() {
return {
restrict: 'A',
require: '?ngMessages',
link: function(scope, elem, attr, ngMessages) {
if (!elem.attr('aria-live')) {
elem.attr('aria-live', 'assertive');
}
}
};
})
.directive('ngClick', ngAriaTabindex)
.directive('ngDblclick', ngAriaTabindex);
10 changes: 10 additions & 0 deletions test/ngAria/ariaSpec.js
Original file line number Diff line number Diff line change
@@ -400,6 +400,16 @@ describe('$aria', function() {
});
});

describe('announcing ngMessages', function() {
beforeEach(injectScopeAndCompiler);

it('should attach aria-live', function() {
var element = [
$compile('<div ng-messages="myForm.myName.$error">')(scope)
];
expectAriaAttrOnEachElement(element, 'aria-live', "assertive");
});
});

describe('aria-value when disabled', function() {
beforeEach(configAriaProvider({