Skip to content

Commit ea314ef

Browse files
committed
fix(*): Fix Tooltip targets
1 parent efab918 commit ea314ef

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/components/chat/chat-state.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,8 @@ export class ChatState {
328328
? html`<div>
329329
<igc-icon-button
330330
id="copy-response-button"
331-
@pointerenter=${() =>
332-
this.showTooltip(
333-
'copy-response-button',
334-
this.resourceStrings.reactionCopyResponse
335-
)}
331+
@pointerenter=${(ev: PointerEvent) =>
332+
this.showTooltip(ev, this.resourceStrings.reactionCopyResponse)}
336333
name="copy-response"
337334
collection="material"
338335
variant="flat"
@@ -341,11 +338,8 @@ export class ChatState {
341338
></igc-icon-button>
342339
<igc-icon-button
343340
id="good-response-button"
344-
@pointerenter=${() =>
345-
this.showTooltip(
346-
'good-response-button',
347-
this.resourceStrings.reactionGoodResponse
348-
)}
341+
@pointerenter=${(ev: PointerEvent) =>
342+
this.showTooltip(ev, this.resourceStrings.reactionGoodResponse)}
349343
name="good-response"
350344
collection="material"
351345
variant="flat"
@@ -354,11 +348,8 @@ export class ChatState {
354348
></igc-icon-button>
355349
<igc-icon-button
356350
id="bad-response-button"
357-
@pointerenter=${() =>
358-
this.showTooltip(
359-
'bad-response-button',
360-
this.resourceStrings.reactionBadResponse
361-
)}
351+
@pointerenter=${(ev: PointerEvent) =>
352+
this.showTooltip(ev, this.resourceStrings.reactionBadResponse)}
362353
name="bad-response"
363354
variant="flat"
364355
collection="material"
@@ -367,11 +358,8 @@ export class ChatState {
367358
></igc-icon-button>
368359
<igc-icon-button
369360
id="redo-button"
370-
@pointerenter=${() =>
371-
this.showTooltip(
372-
'redo-button',
373-
this.resourceStrings.reactionRedo
374-
)}
361+
@pointerenter=${(ev: PointerEvent) =>
362+
this.showTooltip(ev, this.resourceStrings.reactionRedo)}
375363
name="redo"
376364
variant="flat"
377365
collection="material"
@@ -426,11 +414,11 @@ export class ChatState {
426414
`;
427415
};
428416

429-
private showTooltip(elementId: string, text: string) {
417+
private showTooltip(ev: PointerEvent, text: string) {
430418
if (!this._sharedTooltip) return;
431419
this._sharedTooltip.message = text;
432420
this._sharedTooltip.hideDelay = 300;
433-
this._sharedTooltip.show(elementId);
421+
this._sharedTooltip.show(ev.composedPath()[0] as any);
434422
}
435423

436424
//#endregion

0 commit comments

Comments
 (0)