@@ -52,7 +52,7 @@ angular
52
52
* </hljs>
53
53
*/
54
54
55
- function MdSubheaderDirective ( $mdSticky , $compile , $mdTheming , $mdUtil ) {
55
+ function MdSubheaderDirective ( $mdSticky , $compile , $mdTheming , $mdUtil , $mdAria ) {
56
56
return {
57
57
restrict : 'E' ,
58
58
replace : true ,
@@ -78,6 +78,12 @@ function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil) {
78
78
return angular . element ( el [ 0 ] . querySelector ( '.md-subheader-content' ) ) ;
79
79
}
80
80
81
+ // Set the ARIA attributes on the original element since it keeps it's original place in
82
+ // the DOM, whereas the clones are in reverse order. Should be done after the outerHTML,
83
+ // in order to avoid having multiple element be marked as headers.
84
+ attr . $set ( 'role' , 'heading' ) ;
85
+ $mdAria . expect ( element , 'aria-level' , '2' ) ;
86
+
81
87
// Transclude the user-given contents of the subheader
82
88
// the conventional way.
83
89
transclude ( scope , function ( clone ) {
@@ -92,7 +98,7 @@ function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil) {
92
98
// compiled clone below will only be a comment tag (since they replace their elements with
93
99
// a comment) which cannot be properly passed to the $mdSticky; so we wrap it in our own
94
100
// DIV to ensure we have something $mdSticky can use
95
- var wrapper = $compile ( '<div class="md-subheader-wrapper">' + outerHTML + '</div>' ) ( scope ) ;
101
+ var wrapper = $compile ( '<div class="md-subheader-wrapper" aria-hidden="true" >' + outerHTML + '</div>' ) ( scope ) ;
96
102
97
103
// Delay initialization until after any `ng-if`/`ng-repeat`/etc has finished before
98
104
// attempting to create the clone
0 commit comments