Skip to content

Commit

Permalink
fix: allow ActiveOverlay to manage open state
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Jan 27, 2021
1 parent 6c496c0 commit a7c4cff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
12 changes: 1 addition & 11 deletions packages/dialog/dialog-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,7 @@ import { DialogWrapper } from '@spectrum-web-components/dialog';
>
Content of the dialog
</sp-dialog-wrapper>
<sp-button
slot="trigger"
variant="primary"
onClick="
const overlayTrigger = this.parentElement;
overlayTrigger.clickContent.open = true;
"
>
Toggle Dialog
</sp-button>
<sp-button slot="trigger" variant="primary">Toggle Dialog</sp-button>
</overlay-trigger>
```

Expand All @@ -72,7 +63,6 @@ import { DialogWrapper } from '@spectrum-web-components/dialog';
onClick="
const overlayTrigger = this.parentElement;
const dialogWrapper = overlayTrigger.clickContent;
dialogWrapper.open = true;
function handleEvent({type}) {
spAlert(this, `<sp-dialog-wrapper> '${type}' event handled.`);
dialogWrapper.open = false;
Expand Down
3 changes: 3 additions & 0 deletions packages/popover/src/Popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class Popover extends SpectrumElement {
return [popoverStyles];
}

@property({ type: Boolean, reflect: true })
public open = false;

/**
* @type {"auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | "none"}
* @attr
Expand Down
3 changes: 3 additions & 0 deletions packages/tooltip/src/Tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class Tooltip extends SpectrumElement {
return [tooltipStyles];
}

@property({ type: Boolean, reflect: true })
public open = false;

/**
* @type {"auto" | "auto-start" | "auto-end" | "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end" | "none"}
* @attr
Expand Down

0 comments on commit a7c4cff

Please sign in to comment.