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 不显示问题 #30002

Closed
1 task
liaoyubo opened this issue Apr 1, 2021 · 3 comments
Closed
1 task

Tooltip 不显示问题 #30002

liaoyubo opened this issue Apr 1, 2021 · 3 comments

Comments

@liaoyubo
Copy link

liaoyubo commented Apr 1, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

鼠标悬浮 button myBtn 上

What is expected?

鼠标悬浮 myBtn 上显现 tooltip

What is actually happening?

鼠标悬浮 myBtn 上未显现 tooltip

Environment Info
antd 4.11.1
React 16.14
System mac
Browser chorme 89.0.4389.90

import React from 'react';
import ReactDOM from 'react-dom';
import 'antd/dist/antd.css';
import './index.css';
import { Tooltip, Button } from 'antd';

const MyButton = () => {
return (
myBtn
)
}

ReactDOM.render(

button
, document.getElementById('container'), );
@kerm1it
Copy link
Member

kerm1it commented Apr 1, 2021

试试这个:https://codesandbox.io/s/jiben-antd4150-forked-izlhz?file=/index.js

因为 tooltip 会监听子元素的鼠标事件,MyButton 需要把传入的监听器透传给 Button,这个 Button 的事件可以冒泡到 tooltip 上,否则中间就中断了。

@kerm1it kerm1it closed this as completed Apr 1, 2021
@laochake
Copy link

laochake commented Apr 6, 2021

试试这个:https://codesandbox.io/s/jiben-antd4150-forked-izlhz?file=/index.js

因为 tooltip 会监听子元素的鼠标事件,MyButton 需要把传入的监听器透传给 Button,这个 Button 的事件可以冒泡到 tooltip 上,否则中间就中断了。

https://codesandbox.io/s/jiben-antd4150-forked-birg6?file=/index.js 试了下 透传props, 但是如果Button是disabled下又不可以了

@afc163
Copy link
Member

afc163 commented Apr 6, 2021

#9581 (comment)

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

No branches or pull requests

4 participants