-
-
Notifications
You must be signed in to change notification settings - Fork 50.5k
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 组件隐藏后,希望能删除 DOM 节点 #19536
Tooltip 组件隐藏后,希望能删除 DOM 节点 #19536
Comments
有一个 |
Hi there, I think Hovering: <div style="position: absolute; top: 0px; left: 0px; width: 100%;">
<div>
<div
class="rc-tooltip rc-tooltip-placement-right "
style="left: 737px; top: 28px;"
>
<div class="rc-tooltip-content">
<div class="rc-tooltip-arrow" />
<div class="rc-tooltip-inner" role="tooltip">
<span>powered by rc-tooltip</span>
</div>
</div>
</div>
</div>
</div> Mouse leave: <div style="position: absolute; top: 0px; left: 0px; width: 100%;">
<div></div>
</div> This strange div container stays. After a little deep dive, I found that this behavior is caused by the usage of Check this: https://github.com/react-component/trigger/blob/2.2.2/src/index.js#L585 Also checked the lastest working on version It's better if we could also clean up the appended child, say during |
@Arthur-Conan-Dog I think you are right. |
thanks, PortalWrapper has |
Hello @hudidit. We totally like your proposal/feedback, welcome to send us Pull Request for it. Please send your Pull Request to proper branch (feature branch for new feature, master for bugfix and other changes), fill the [Pull Request Template] here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. Appreciate it advance and we are looking forword to your contribution! 你好 @hudidit, 我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支(新特性发到 feature 分支,其他发到 master 分支),务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献! |
#178 给 |
@afc163 看看tooltip的那个pr,没问题就可以合了。 |
感觉应该改进 |
这样可以的,主要加是为了做兼容,你说的这种方法更好。 |
可以加到 minor version 里 |
@hudidit 最终没有增加 |
antd 还要升级一下。 |
需要reopen吗? |
What problem does this feature solve?
现状
Tooltip 展示时会向 DOM 中插入一个 div 节点,以及一些子节点。但是隐藏时并没有删除这个节点。当页面中有很多个 Tooltip 实例时,每展示一个就会向 DOM 中插入一组节点,越来越多。
如图所示:
预期
希望 Tooltip 在隐藏后,能够删除对应的 DOM 节点。或者,提供一个配置项,支持用户选择是否要清理 DOM 节点。
好处:
What does the proposed API look like?
参考 Ant Modal 组件的
destroyOnClose
,可以增加一个destroyOnHide
参数。e.g.
The text was updated successfully, but these errors were encountered: