Skip to content

Commit

Permalink
Merge pull request #699 from material-components:dialog-open-fn
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 285987721
  • Loading branch information
copybara-github committed Dec 17, 2019
2 parents 34a18dc + bc6a4ee commit 6eef5e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- CSS styling options to `mwc-tab`
- `active` attribute to `mwc-tab` when (de)activated
- Added custom properties to style `mwc-checkbox`'s colors
- Added `show` and `close` methods to `mwc-dialog`

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion packages/dialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ npm install @material/mwc-dialog
| -------- | -------------
| `forceLayout() => void` | Forces dialog to relayout (animation frame time). May be required if dialog size is incorrect or if stacked layout has not been triggered correctly.
| `focus() => void` | Focuses on the initial focus element if defined (see [focus section](#focus)).
| `blur() => void` | Blurs the active element.
| `blur() => void` | Blurs the active element.
| `show() => void` | Opens the dialog.
| `close() => void` | Closes the dialog.

### Listeners
| Event Name | Target | Description
Expand Down
8 changes: 8 additions & 0 deletions packages/dialog/src/mwc-dialog-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,12 @@ export class DialogBase extends BaseElement {
'keydown', this.boundHandleDocumentKeydown);
}
}

close() {
this.open = false;
}

show() {
this.open = true;
}
}

0 comments on commit 6eef5e2

Please sign in to comment.