fix tooltip positioning

This commit is contained in:
Cory LaViska
2021-11-24 10:20:44 -05:00
parent ecdf507645
commit 4304d8badd
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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) {
@@ -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>
`;