File tree Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Expand file tree Collapse file tree 5 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 11.demo-sidenav-layout {
22 border : 3px solid black ;
33
4- md-sidenav {
4+ . md-sidenav-focus-trap > .cdk-focus-trap-content {
55 padding : 10px ;
66 }
77}
Original file line number Diff line number Diff line change 1- import { Component } from '@angular/core' ;
1+ import { Component , ViewEncapsulation } from '@angular/core' ;
22
33
44@Component ( {
55 moduleId : module . id ,
66 selector : 'sidenav-demo' ,
77 templateUrl : 'sidenav-demo.html' ,
88 styleUrls : [ 'sidenav-demo.css' ] ,
9+ encapsulation : ViewEncapsulation . None ,
910} )
1011export class SidenavDemo {
1112 side = 'start' ;
Original file line number Diff line number Diff line change 11< div *ngIf ="!disabled " tabindex ="0 " (focus) ="focusLastTabbableElement() "> </ div >
2- < div #trappedContent > < ng-content > </ ng-content > </ div >
2+ < div #trappedContent class =" cdk-focus-trap-content " > < ng-content > </ ng-content > </ div >
33< div *ngIf ="!disabled " tabindex ="0 " (focus) ="focusFirstTabbableElement() "> </ div >
Original file line number Diff line number Diff line change @@ -109,9 +109,6 @@ md-sidenav {
109109 min-width : 5% ;
110110 outline : 0 ;
111111
112- // TODO(kara): revisit scrolling behavior for sidenavs
113- overflow-y : auto ;
114-
115112 @include md-sidenav-transition (0 , -100% );
116113
117114 & .md-sidenav-side {
@@ -136,6 +133,16 @@ md-sidenav {
136133 }
137134}
138135
136+ .md-sidenav-focus-trap {
137+ height : 100% ;
138+
139+ > .cdk-focus-trap-content {
140+ box-sizing : border-box ;
141+ height : 100% ;
142+ overflow-y : auto ; // TODO(kara): revisit scrolling behavior for sidenavs
143+ }
144+ }
145+
139146.md-sidenav-invalid {
140147 display : none ;
141148}
Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ export class MdSidenavToggleResult {
4646@Component ( {
4747 moduleId : module . id ,
4848 selector : 'md-sidenav, mat-sidenav' ,
49- template : '<focus-trap [disabled]="isFocusTrapDisabled"><ng-content></ng-content></focus-trap>' ,
49+ // TODO(mmalerba): move template to separate file.
50+ template : `
51+ <focus-trap class="md-sidenav-focus-trap" [disabled]="isFocusTrapDisabled">
52+ <ng-content></ng-content>
53+ </focus-trap>` ,
5054 host : {
5155 '(transitionend)' : '_onTransitionEnd($event)' ,
5256 '(keydown)' : 'handleKeydown($event)' ,
You can’t perform that action at this time.
0 commit comments