Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix tooltip dom not remove #2605

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DaiQiangReal
Copy link
Collaborator

@DaiQiangReal DaiQiangReal commented Dec 3, 2024

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

Fixes #

Changelog

🇨🇳 Chinese

  • Fix: 修复在 React18 下无论是否动画开启,快速移动鼠标在 tooltip trigger 上时,概率性 dom 只透明但不消失,导致无法点击页面元素的问题

🇺🇸 English

  • Fix: Fixed the issue where in react18, regardless of whether animation is on or not, when the mouse is quickly moved over the tooltip trigger, the DOM would become transparent but not disappear, causing the page element to be unclickable

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

Copy link

codesandbox-ci bot commented Dec 3, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 79796e6:

Sandbox Source
pr-story Configuration

@DaiQiangReal
Copy link
Collaborator Author

DaiQiangReal commented Dec 3, 2024

#2461 问题相似但原因不同。

tooltip 在insertPortal之后,setState 回调被 react 触发之前,用户触发了 trigger leave 事件,但此时visible state 值仍然为false,导致逻辑分支不正确的问题。

通过在 leave 逻辑分支中不仅通过 visible 判断当前状态也通过 isInsert 判断当前状态来保证 triggerLeave 的时候 一定移除 dom,同时在 insertPortal 的 setState 回调中添加 空 setState,用于获取 同 batch 的 state 来判断是否处于刚显示又隐藏的特殊case,从而取消后续操作。

顺便修复了下之前 popconfirm 单测中点击了取消又点击确认的问题,本应不通过但之前的 tooltip 会通过。

Copy link

cypress bot commented Dec 3, 2024

semi-design    Run #2992

Run Properties:  status check passed Passed #2992  •  git commit b5caa6fc4d ℹ️: Merge 79796e64323b884babfcbd90562f34e912654f01 into 0949ade9c9c438142acb453924ef...
Project semi-design
Branch Review fix_tooltip_dom_not_remove
Run status status check passed Passed #2992
Run duration 07m 47s
Commit git commit b5caa6fc4d ℹ️: Merge 79796e64323b884babfcbd90562f34e912654f01 into 0949ade9c9c438142acb453924ef...
Committer 代强
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 11
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 276
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants