From d66f120f7831da830274e6aedfa44c732361d22b Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 22 Oct 2020 21:54:26 -0400 Subject: [PATCH] Fix initial open state in dialog/drawer; closes #255 --- docs/getting-started/changelog.md | 1 + src/components/dialog/dialog.tsx | 6 +++--- src/components/drawer/drawer.tsx | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/getting-started/changelog.md b/docs/getting-started/changelog.md index 916207a4..75c79ffb 100644 --- a/docs/getting-started/changelog.md +++ b/docs/getting-started/changelog.md @@ -9,6 +9,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis ## Next - Added `no-scroll-controls` prop to `sl-tab-group` +- Fixed a bug where setting `open` initially wouldn't show `sl-dialog` or `sl-drawer` - Fixed a bug where `disabled` could be set when buttons are rendered as links - Fixed a bug where hoisted dropdowns would render in the wrong position when place inside an `sl-dialog` - Improved `sl-dropdown` accessibility by attaching `aria-haspopup` and `aria-expanded` to the slotted trigger diff --git a/src/components/dialog/dialog.tsx b/src/components/dialog/dialog.tsx index 8061d032..313f7c67 100644 --- a/src/components/dialog/dialog.tsx +++ b/src/components/dialog/dialog.tsx @@ -86,7 +86,7 @@ export class Dialog { }); } - componentDidLoad() { + componentWillLoad() { // Show on init if open if (this.open) { this.show(); @@ -101,7 +101,7 @@ export class Dialog { @Method() async show() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (this.open) { + if (this.isVisible) { return; } @@ -122,7 +122,7 @@ export class Dialog { @Method() async hide() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (!this.open) { + if (!this.isVisible) { return; } diff --git a/src/components/drawer/drawer.tsx b/src/components/drawer/drawer.tsx index dd6ceb69..fb50bcd3 100644 --- a/src/components/drawer/drawer.tsx +++ b/src/components/drawer/drawer.tsx @@ -94,7 +94,7 @@ export class Drawer { }); } - componentDidLoad() { + componentWillLoad() { // Show on init if open if (this.open) { this.show(); @@ -109,7 +109,7 @@ export class Drawer { @Method() async show() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (this.open) { + if (this.isVisible) { return; } @@ -133,7 +133,7 @@ export class Drawer { @Method() async hide() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (!this.open) { + if (!this.isVisible) { return; }