-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(drawer): Add additional documentation for disableClose #6750
Conversation
@willshowell you mentioned in #6427 that dialog already does something like this? Do you know what the Observable is called? I'd like to keep it consistent across components |
@mmalerba it hasn't yet been merged but it will be a generic It was @jelbourn's opinion (#3460 (comment)) that the consumer can filter for desired keys, but that may have only been because overlay is very generic. |
@mmalerba Would you recommend changing |
I actually wonder if we even need it for sidenav, it seems like its just a proxy for <md-drawer-container (backdropClick)="customBackdropClickHandler()">
<md-drawer disableClose (keydown)="customKeydownHandler($event)"></md-drawer>
</md-drawer-container> |
Reverted changes made to |
src/lib/sidenav/sidenav.md
Outdated
### Sidenav vs. Drawer | ||
The difference between sidenav and drawer is that the sidenav takes up fullscreen whereas drawer is a smaller element | ||
that takes up a subsection of the screen. `md-sidenav` has to be placed inside `md-sidenav-container` and `md-drawer` | ||
has to be placed inside `md-drawer-container`. More functionalities will be added to sidenav in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the last sentence how about:
Currently `md-drawer` and `md-sidenav`support all the same features. However in the future we expect to add different features specific to the different use cases.
src/lib/sidenav/sidenav.md
Outdated
@@ -70,3 +70,19 @@ html, body, material-app, md-sidenav-container, .my-content { | |||
### FABs inside sidenav | |||
For a sidenav with a FAB (Floating Action Button) or other floating element, the recommended approach is to place the FAB | |||
outside of the scrollable region and absolutely position it. | |||
|
|||
### Sidenav vs. Drawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this at the top since its important context that users need to understand the rest of the docs (that all the stuff we're saying about sidenavs also applies to drawer
src/lib/sidenav/sidenav.md
Outdated
|
||
### Disabling closing of sidenav and drawer | ||
By default, sidenav and drawer can be closed either by clicking on the backdrop or by pressing <kbd>ESCAPE</kbd>. | ||
`disableClose` attribute can be set on `md-drawer` or `md-sidenav` to disable closing by two methods. To enable one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disableClose
attribute
"closing by two methods" --> "automatic closing when the backdrop is clicked or the escape key is pressed"
src/lib/sidenav/sidenav.md
Outdated
### Disabling closing of sidenav and drawer | ||
By default, sidenav and drawer can be closed either by clicking on the backdrop or by pressing <kbd>ESCAPE</kbd>. | ||
`disableClose` attribute can be set on `md-drawer` or `md-sidenav` to disable closing by two methods. To enable one | ||
of the two methods to allow closing with `disableClose` attribute set, then custom event handlers can be used as below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add custom logic on backdrop click, add a (backdropClick)
listener to the md-sidenav-container
. For custom escape key logic, a standard (keydown)
listener will suffice.
src/lib/sidenav/sidenav.md
Outdated
`disableClose` attribute can be set on `md-drawer` or `md-sidenav` to disable closing by two methods. To enable one | ||
of the two methods to allow closing with `disableClose` attribute set, then custom event handlers can be used as below: | ||
```html | ||
<md-drawer-container (backdropClick)="customBackdropClickHandler()"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since every other example in this doc uses sidenav, lets use sidenav. The new explainer about sidenav vs drawer will let people know they can use either
Comments have been addressed 👍 Ready for review |
src/lib/sidenav/sidenav.md
Outdated
@@ -18,6 +18,14 @@ A sidenav container may contain one or two `<md-sidenav>` elements. When there a | |||
`<md-sidenav>` elements, each must be placed on a different side of the container. | |||
See the section on positioning below. | |||
|
|||
|
|||
### Sidenav vs. Drawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't make this a separate section, just part of the section above. It also needs to be worded to introduce the drawer, otherwise us: "The difference between sidenav and drawer..." user: "wait, what's drawer?"
Changes have been made 😃 |
src/lib/sidenav/sidenav.md
Outdated
@@ -18,6 +18,13 @@ A sidenav container may contain one or two `<md-sidenav>` elements. When there a | |||
`<md-sidenav>` elements, each must be placed on a different side of the container. | |||
See the section on positioning below. | |||
|
|||
`<md-drawer>` is a component that is similar to `<md-sidenav>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought I'll just add some documentation on md-drawer
later, for now lets not mention it since its the exact same thing as md-sidenav
src/lib/sidenav/sidenav.md
Outdated
|
||
### Disabling closing of sidenav and drawer | ||
By default, sidenav and drawer can be closed either by clicking on the backdrop or by pressing <kbd>ESCAPE</kbd>. | ||
The `disableClose` attribute can be set on `md-drawer` or `md-sidenav` to disable automatic closing when the backdrop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove mention of md-drawer
Removed everything related to |
src/lib/sidenav/sidenav.md
Outdated
By default, sidenav can be closed either by clicking on the backdrop or by pressing <kbd>ESCAPE</kbd>. | ||
The `disableClose` attribute can be set on `md-sidenav` to disable automatic closing when the backdrop | ||
is clicked or <kbd>ESCAPE</kbd> is pressed. To add custom logic on backdrop click, add a `(backdropClick)` listener to | ||
`md-sidenav-container`. For custom <kdb>ESCAPE</kbd> logic, a standard `(keydown)` listener will suffice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo <kdb>
-> <kbd>
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ESCAPE
keydown is exposed as an event to support various cases.Fixes #6427