Skip to content

Commit 73e2305

Browse files
committed
fix(tooltip): make tooltip hoverable
1 parent b8e9926 commit 73e2305

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/tooltip/src/LionTooltip.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ export class LionTooltip extends LionPopup {
2020
this._show = () => this._controller.show();
2121
this._hide = () => this._controller.hide();
2222

23-
this.invokerNode.addEventListener('mouseenter', this._show);
24-
this.invokerNode.addEventListener('mouseleave', this._hide);
23+
this.addEventListener('mouseenter', this._show);
24+
this.addEventListener('mouseleave', this._hide);
2525
this.invokerNode.addEventListener('focusin', this._show);
2626
this.invokerNode.addEventListener('focusout', this._hide);
2727
}
2828

2929
disconnectedCallback() {
3030
super.disconnectedCallback();
31-
this.invokerNode.removeEventListener('mouseenter', this._show);
32-
this.invokerNode.removeEventListener('mouseleave', this._hide);
31+
this.removeEventListener('mouseenter', this._show);
32+
this.removeEventListener('mouseleave', this._hide);
3333
this.invokerNode.removeEventListener('focusin', this._show);
3434
this.invokerNode.removeEventListener('focusout', this._hide);
3535
}

packages/tooltip/test/lion-tooltip.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ describe('lion-tooltip', () => {
2121
<lion-button slot="invoker">Tooltip button</lion-button>
2222
</lion-tooltip>
2323
`);
24-
const invoker = el.querySelector('[slot="invoker"]');
2524
const eventMouseEnter = new Event('mouseenter');
26-
invoker.dispatchEvent(eventMouseEnter);
25+
el.dispatchEvent(eventMouseEnter);
2726
await el.updateComplete;
2827
expect(el.querySelector('[slot="content"]').style.display).to.be.equal('inline-block');
2928
const eventMouseLeave = new Event('mouseleave');
30-
invoker.dispatchEvent(eventMouseLeave);
29+
el.dispatchEvent(eventMouseLeave);
3130
await el.updateComplete;
3231
expect(el.querySelector('[slot="content"]').style.display).to.be.equal('none');
3332
});

0 commit comments

Comments
 (0)