Skip to content

Commit 14f798a

Browse files
committed
fix(tooltip): correct tooltip visibility state management for fadeOut animation
1 parent fb87359 commit 14f798a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/tooltip/tooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,9 @@ export default class IgcTooltipComponent extends EventEmitterMixin<
285285

286286
await this._setDelay(this.hideDelay);
287287

288-
this.open = false;
289288
this.toBeHidden = true;
290289
const result = await this._toggleAnimation('close');
290+
this.open = false;
291291
this.toBeHidden = false;
292292

293293
return result;

stories/tooltip.stories.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,22 @@ export const Toggle: Story = {
294294
// Use a template ref id to target the tooltip instance
295295
const tooltipId = 'toggle-tooltip';
296296
const buttonId = 'toggle-button';
297+
const buttonIdToggler = 'toggler-button';
297298

298299
// Hook into the rendered DOM to attach click listener
299300
setTimeout(() => {
300301
const tooltip = document.getElementById(tooltipId) as IgcTooltipComponent;
301-
const button = document.getElementById(buttonId) as HTMLButtonElement;
302+
const button = document.getElementById(
303+
buttonIdToggler
304+
) as HTMLButtonElement;
302305

303306
if (tooltip && button) {
304307
button.addEventListener('click', () => tooltip.toggle());
305308
}
306309
});
307310

308311
return html`
312+
<igc-button id=${buttonIdToggler}>Toggle</igc-button>
309313
<igc-button id=${buttonId}>Toggle Tooltip</igc-button>
310314
<igc-tooltip
311315
id=${tooltipId}

0 commit comments

Comments
 (0)