@@ -118,7 +118,7 @@ export class MdDrawer implements AfterContentInit, OnDestroy {
118
118
/** Mode of the drawer; one of 'over', 'push' or 'side'. */
119
119
@Input ( ) mode : 'over' | 'push' | 'side' = 'over' ;
120
120
121
- /** Whether the drawer can be closed with the escape key or not . */
121
+ /** Whether the drawer can be closed with the escape key or by clicking on the backdrop . */
122
122
@Input ( )
123
123
get disableClose ( ) : boolean { return this . _disableClose ; }
124
124
set disableClose ( value : boolean ) { this . _disableClose = coerceBooleanProperty ( value ) ; }
@@ -152,6 +152,9 @@ export class MdDrawer implements AfterContentInit, OnDestroy {
152
152
/** Event emitted when the drawer's position changes. */
153
153
@Output ( 'positionChanged' ) onPositionChanged = new EventEmitter < void > ( ) ;
154
154
155
+ /** Event emitted when ESCAPE is pressed. */
156
+ @Output ( ) escapeKeydown = new EventEmitter < void > ( ) ;
157
+
155
158
/** @deprecated */
156
159
@Output ( 'align-changed' ) onAlignChanged = new EventEmitter < void > ( ) ;
157
160
@@ -259,9 +262,12 @@ export class MdDrawer implements AfterContentInit, OnDestroy {
259
262
* @docs -private
260
263
*/
261
264
handleKeydown ( event : KeyboardEvent ) {
262
- if ( event . keyCode === ESCAPE && ! this . disableClose ) {
263
- this . close ( ) ;
264
- event . stopPropagation ( ) ;
265
+ if ( event . keyCode === ESCAPE ) {
266
+ this . escapeKeydown . emit ( ) ;
267
+ if ( ! this . disableClose ) {
268
+ this . close ( ) ;
269
+ event . stopPropagation ( ) ;
270
+ }
265
271
}
266
272
}
267
273
0 commit comments