Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0cdd758

Browse files
author
Marcy Sutton
committedFeb 7, 2015
feat(ngAria): Adds button role to ng-click
Closes #9254
1 parent 93253df commit 0cdd758

File tree

2 files changed

+87
-69
lines changed

2 files changed

+87
-69
lines changed
 

‎src/ngAria/aria.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
*
2323
* | Directive | Supported Attributes |
2424
* |---------------------------------------------|----------------------------------------------------------------------------------------|
25-
* | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required |
2625
* | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
2726
* | {@link ng.directive:ngShow ngShow} | aria-hidden |
2827
* | {@link ng.directive:ngHide ngHide} | aria-hidden |
29-
* | {@link ng.directive:ngClick ngClick} | tabindex, keypress event |
3028
* | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
3129
* | {@link module:ngMessages ngMessages} | aria-live |
30+
* | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
31+
* | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
3232
*
3333
* Find out more information about each directive by reading the
3434
* {@link guide/accessibility ngAria Developer Guide}.
@@ -320,6 +320,9 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
320320
return true;
321321
}
322322
}
323+
if (!elem.attr('role') && !isNodeOneOf(elem, ['BUTTON', 'A'])) {
324+
elem.attr('role', 'button');
325+
}
323326

324327
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
325328
elem.attr('tabindex', 0);

0 commit comments

Comments
 (0)
This repository has been archived.