fix tooltip reconnection; closes #1595 (#1603)

This commit is contained in:
Cory LaViska
2025-10-15 13:02:17 -04:00
committed by GitHub
parent 322491d84d
commit 24f6508716
2 changed files with 17 additions and 2 deletions

View File

@@ -30,10 +30,11 @@ Components with the <wa-badge variant="warning">Experimental</wa-badge> badge sh
- Fixed a bug in `<wa-checkbox>` where its value would revert to `""` when checked / unchecked [pr:1547]
- Fixed a bug that caused icon button labels to not render in frameworks [issue:1542]
- Fixed a bug in `<wa-details>` that caused the `name` property not to reflect [pr:1538]
- Modified `<wa-slider>` to only show the tooltip on the handle being dragged when in range mode [issue:1320]
- Fixed a bug in `<wa-dialog>` and `<wa-drawer>` that prevented focus from being set on the dialog/drawer when opened [issue:1302]
- Fixed an overflow style that was causing tab group content to be unnecessarily truncated [issue:1401]
- Fixed a bug in `<wa-icon>` that caused icon buttons to render when non-text nodes were slotted in [issue:1475]
- Fixed a bug in `<wa-tooltip>` that prevented tooltips from showing when disconnecting and then reconnecting to the DOM [issue:1595]
- Modified `<wa-slider>` to only show the tooltip on the handle being dragged when in range mode [issue:1320]
## 3.0.0-beta.6
@@ -477,4 +478,4 @@ Many of these changes and improvements were the direct result of feedback from u
</details>
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome/discussions)
Did we miss something? [Let us know!](https://github.com/shoelace-style/webawesome/discussions)

View File

@@ -101,6 +101,11 @@ export default class WaTooltip extends WebAwesomeElement {
connectedCallback() {
super.connectedCallback();
// Recreate event controller if it was aborted
if (this.eventController.signal.aborted) {
this.eventController = new AbortController();
}
// TODO: This is a hack that I need to revisit [Konnor]
if (this.open) {
this.open = false;
@@ -113,6 +118,15 @@ export default class WaTooltip extends WebAwesomeElement {
if (!this.id) {
this.id = uniqueId('wa-tooltip-');
}
// Re-establish anchor connection after being disconnected
if (this.for && this.anchor) {
this.anchor = null; // force reattach
this.handleForChange();
} else if (this.for) {
// Initial connection
this.handleForChange();
}
}
disconnectedCallback() {