Skip to content

Commit 2194c53

Browse files
committed
revert changes and update doc instead
1 parent 5a0b1f0 commit 2194c53

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/lib/sidenav/drawer.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ export class MdDrawer implements AfterContentInit, OnDestroy {
152152
/** Event emitted when the drawer's position changes. */
153153
@Output('positionChanged') onPositionChanged = new EventEmitter<void>();
154154

155-
/** Event emitted when ESCAPE is pressed. */
156-
@Output() escapeKeydown = new EventEmitter<void>();
157-
158155
/** @deprecated */
159156
@Output('align-changed') onAlignChanged = new EventEmitter<void>();
160157

@@ -262,12 +259,9 @@ export class MdDrawer implements AfterContentInit, OnDestroy {
262259
* @docs-private
263260
*/
264261
handleKeydown(event: KeyboardEvent) {
265-
if (event.keyCode === ESCAPE) {
266-
this.escapeKeydown.emit();
267-
if (!this.disableClose) {
268-
this.close();
269-
event.stopPropagation();
270-
}
262+
if (event.keyCode === ESCAPE && !this.disableClose) {
263+
this.close();
264+
event.stopPropagation();
271265
}
272266
}
273267

src/lib/sidenav/sidenav.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,19 @@ html, body, material-app, md-sidenav-container, .my-content {
7070
### FABs inside sidenav
7171
For a sidenav with a FAB (Floating Action Button) or other floating element, the recommended approach is to place the FAB
7272
outside of the scrollable region and absolutely position it.
73+
74+
### Sidenav vs. Drawer
75+
The difference between sidenav and drawer is that the sidenav takes up fullscreen whereas drawer is a smaller element
76+
that takes up a subsection of the screen. `md-sidenav` has to be placed inside `md-sidenav-container` and `md-drawer`
77+
has to be placed inside `md-drawer-container`. More functionalities will be added to sidenav in the future.
78+
79+
80+
### Disabling closing of sidenav and drawer
81+
By default, sidenav and drawer can be closed either by clicking on the backdrop or by pressing <kbd>ESCAPE</kbd>.
82+
`disableClose` attribute can be set on `md-drawer` or `md-sidenav` to disable closing by two methods. To enable one
83+
of the two methods to allow closing with `disableClose` attribute set, then custom event handlers can be used as below:
84+
```html
85+
<md-drawer-container (backdropClick)="customBackdropClickHandler()">
86+
<md-drawer disableClose (keydown)="customKeydownHandler($event)"></md-drawer>
87+
</md-drawer-container>
88+
```

0 commit comments

Comments
 (0)