diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index bf30d5bcf..b6016257e 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -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 `` where the tooltip wouldn't reposition when content changed - Upgraded the status of `` from experimental to stable ## 2.0.0-beta.61 diff --git a/src/components/tooltip/tooltip.ts b/src/components/tooltip/tooltip.ts index fcebb9c48..8b952d622 100644 --- a/src/components/tooltip/tooltip.ts +++ b/src/components/tooltip/tooltip.ts @@ -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'} > - ${this.content} + ${this.content} `;