Skip to content

Commit

Permalink
fix: Remove resize event listening in non-display state of Tooltip (#…
Browse files Browse the repository at this point in the history
…2606)

* fix: Remove resize event listening in non-display state of Tooltip

* fix: [Tooltip] When visible is false, the resize event does not perform position calculation

---------

Co-authored-by: pointhalo <[email protected]>
  • Loading branch information
YyumeiZhang and pointhalo authored Dec 6, 2024
1 parent ccb86ae commit 3e4437a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/semi-foundation/tooltip/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
}
}

updateStateIfCursorOnTrigger = (trigger: HTMLElement)=>{
updateStateIfCursorOnTrigger = (trigger: HTMLElement) => {
if (trigger?.matches?.(":hover")) {
const eventNames = this._adapter.getEventName();
const triggerEventSet = this.getState("triggerEventSet");
Expand Down Expand Up @@ -284,6 +284,10 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
onResize = () => {
// this.log('resize');
// rePosition when window resize
const visible = this.getState('visible');
if (!visible) {
return;
}
this.calcPosition();
};

Expand Down

0 comments on commit 3e4437a

Please sign in to comment.