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

<Tooltip /> 在气泡未展示时,onVisibleChange 的参数可能会为 true #4579

Closed
ystarlongzi opened this issue Jan 12, 2017 · 4 comments · Fixed by #4589
Closed

<Tooltip /> 在气泡未展示时,onVisibleChange 的参数可能会为 true #4579

ystarlongzi opened this issue Jan 12, 2017 · 4 comments · Fixed by #4589
Labels
🐛 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.

Comments

@ystarlongzi
Copy link
Contributor

ystarlongzi commented Jan 12, 2017

当最开始 <Tooltip />title 为空时,在鼠标滑过元素时,onVisibleChange此时获取到当前组件的 visible = true,然后此时并没有气泡,如果值为 false 是不是要合理些?然后这样也会导致当下次组件的 title 从无到有时,气泡会突然出现,而预期的是希望滑过时才会出现气泡。

然后,看了下代码逻辑,如果在/tooltip/index.tsx#L65加个对 titleoverlay 是否为空的判断,应该可以解决这个问题。

见下图,查看demo

222

@benjycui
Copy link
Contributor

把这几行移到你给出的那个 onVisibleChange 函数里面应该可以解决问题:

// Hide tooltip when there is no title
if (!('visible' in props) && !title && !overlay) {
visible = false;
}

@benjycui benjycui added 🐛 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. labels Jan 12, 2017
@benjycui
Copy link
Contributor

可以麻烦你来个 PR?

@ystarlongzi
Copy link
Contributor Author

嗯嗯,好的,稍等

@lock
Copy link

lock bot commented May 2, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 Bug Ant Design Team had proved that this is a bug. help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants