Skip to content

Commit

Permalink
fix tooltip positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed Nov 24, 2021
1 parent ecdf507 commit 4304d8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/resources/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis

- CodePen examples will now open in light or dark depending on your current preference
- Fixed a bug where tag names weren't being generated in `vscode.html-custom-data.json` [#593](https://github.com/shoelace-style/shoelace/pull/593)
- Fixed a bug in `<sl-tooltip>` where the tooltip wouldn't reposition when content changed
- Upgraded the status of `<sl-qr-code>` from experimental to stable

## 2.0.0-beta.61
Expand Down
9 changes: 8 additions & 1 deletion src/components/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ export default class SlTooltip extends LitElement {
this.syncOptions();
}

@watch('content')
handleContentChange() {
if (this.popover && this.open) {
this.popover.update();
}
}

@watch('disabled')
handleDisabledChange() {
if (this.disabled && this.open) {
Expand Down Expand Up @@ -331,7 +338,7 @@ export default class SlTooltip extends LitElement {
role="tooltip"
aria-hidden=${this.open ? 'false' : 'true'}
>
<slot name="content">${this.content}</slot>
<slot name="content" @slotchange=${this.handleContentChange}> ${this.content} </slot>
</div>
</div>
`;
Expand Down

0 comments on commit 4304d8b

Please sign in to comment.