Skip to content

Commit

Permalink
fix(modal): Remove undocumented properties from the Host element. #2059
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed May 5, 2021
1 parent 6b06030 commit 9fd9142
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/calcite-modal/calcite-modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
transform: translate3d(0, 20px, 0);
}

:host([is-active]) {
:host([active]) {
@apply opacity-100;
visibility: visible !important;
transition-delay: 0ms;
Expand Down Expand Up @@ -207,7 +207,7 @@ slot[name="primary"] {
}
}

:host([is-active][fullscreen]) {
:host([active][fullscreen]) {
.modal {
transform: translate3D(0, 0, 0) scale(1);
}
Expand Down
9 changes: 3 additions & 6 deletions src/components/calcite-modal/calcite-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class CalciteModal {
//
//--------------------------------------------------------------------------
/** Add the active attribute to open the modal */
@Prop({ mutable: true }) active?: boolean;
@Prop({ mutable: true, reflect: true }) active?: boolean;

/** Optionally pass a function to run before close */
@Prop() beforeClose: (el: HTMLElement) => Promise<void> = () => Promise.resolve();
Expand Down Expand Up @@ -121,7 +121,7 @@ export class CalciteModal {
render(): VNode {
const dir = getElementDir(this.el);
return (
<Host aria-modal="true" is-active={this.isActive} role="dialog">
<Host aria-modal="true" role="dialog">
<calcite-scrim class="scrim" theme="dark" />
{this.renderStyle()}
<div class={{ modal: true, [CSS_UTILITY.rtl]: dir === "rtl" }}>
Expand Down Expand Up @@ -211,8 +211,6 @@ export class CalciteModal {
// Variables
//
//--------------------------------------------------------------------------
@State() isActive: boolean;

@State() hasFooter = true;

previousActiveElement: HTMLElement;
Expand Down Expand Up @@ -313,7 +311,7 @@ export class CalciteModal {
/** Open the modal */
private open() {
this.previousActiveElement = document.activeElement as HTMLElement;
this.isActive = true;
this.active = true;
clearTimeout(this.focusTimeout);
// wait for the modal to open, then handle focus.
this.focusTimeout = window.setTimeout(() => {
Expand All @@ -327,7 +325,6 @@ export class CalciteModal {
close = (): Promise<void> => {
return this.beforeClose(this.el).then(() => {
this.active = false;
this.isActive = false;
focusElement(this.previousActiveElement);
this.removeOverflowHiddenClass();
setTimeout(() => this.calciteModalClose.emit(), 300);
Expand Down

0 comments on commit 9fd9142

Please sign in to comment.