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 1
1
.demo-sidenav-layout {
2
2
border : 3px solid black ;
3
3
4
- md-sidenav {
4
+ . md-sidenav-focus-trap > .cdk-focus-trap-content {
5
5
padding : 10px ;
6
6
}
7
7
}
Original file line number Diff line number Diff line change 1
- import { Component } from '@angular/core' ;
1
+ import { Component , ViewEncapsulation } from '@angular/core' ;
2
2
3
3
4
4
@Component ( {
5
5
moduleId : module . id ,
6
6
selector : 'sidenav-demo' ,
7
7
templateUrl : 'sidenav-demo.html' ,
8
8
styleUrls : [ 'sidenav-demo.css' ] ,
9
+ encapsulation : ViewEncapsulation . None ,
9
10
} )
10
11
export class SidenavDemo {
11
12
side = 'start' ;
Original file line number Diff line number Diff line change 1
1
< 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 >
3
3
< div *ngIf ="!disabled " tabindex ="0 " (focus) ="focusFirstTabbableElement() "> </ div >
Original file line number Diff line number Diff line change @@ -109,9 +109,6 @@ md-sidenav {
109
109
min-width : 5% ;
110
110
outline : 0 ;
111
111
112
- // TODO(kara): revisit scrolling behavior for sidenavs
113
- overflow-y : auto ;
114
-
115
112
@include md-sidenav-transition (0 , -100% );
116
113
117
114
& .md-sidenav-side {
@@ -136,6 +133,16 @@ md-sidenav {
136
133
}
137
134
}
138
135
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
+
139
146
.md-sidenav-invalid {
140
147
display : none ;
141
148
}
Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ export class MdSidenavToggleResult {
46
46
@Component ( {
47
47
moduleId : module . id ,
48
48
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>` ,
50
54
host : {
51
55
'(transitionend)' : '_onTransitionEnd($event)' ,
52
56
'(keydown)' : 'handleKeydown($event)' ,
You can’t perform that action at this time.
0 commit comments