@@ -52,7 +52,7 @@ angular
5252 * </hljs>
5353 */
5454
55- function MdSubheaderDirective ( $mdSticky , $compile , $mdTheming , $mdUtil ) {
55+ function MdSubheaderDirective ( $mdSticky , $compile , $mdTheming , $mdUtil , $mdAria ) {
5656 return {
5757 restrict : 'E' ,
5858 replace : true ,
@@ -78,6 +78,12 @@ function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil) {
7878 return angular . element ( el [ 0 ] . querySelector ( '.md-subheader-content' ) ) ;
7979 }
8080
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+
8187 // Transclude the user-given contents of the subheader
8288 // the conventional way.
8389 transclude ( scope , function ( clone ) {
@@ -92,7 +98,7 @@ function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil) {
9298 // compiled clone below will only be a comment tag (since they replace their elements with
9399 // a comment) which cannot be properly passed to the $mdSticky; so we wrap it in our own
94100 // 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 ) ;
96102
97103 // Delay initialization until after any `ng-if`/`ng-repeat`/etc has finished before
98104 // attempting to create the clone
0 commit comments