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

Popover and tooltip are not displayed for custom components #15909

Closed
1 task done
Dainius14 opened this issue Apr 7, 2019 · 5 comments
Closed
1 task done

Popover and tooltip are not displayed for custom components #15909

Dainius14 opened this issue Apr 7, 2019 · 5 comments
Labels
❓FAQ issues would be discussed a lot

Comments

@Dainius14
Copy link

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Create a custom component and use it in a popover or tooltip.

What is expected?

Popover/tooltip is shown when hovering over the element

What is actually happening?

Popover/tooltip is not shown

Environment Info
antd 3.16.1
React 16.8.3
System Windows 10
Browser Vivaldi 2.4.1488.35, Firefox 66.0.1

Wrapping the component inside a

or in popover itself solves the problem. DOM is identical for both cases.

@afc163
Copy link
Member

afc163 commented Apr 8, 2019

Check https://codesandbox.io/s/sweet-bessie-t9wr74?file=/src/index.js

- const Item = ({ text }) => {
-   return <span>text</span>;
+ const Item = ({ text, ...props }) => {
+   return <span {...props}>text</span>;
  }

You should pass props to children element.

See #15528 (comment)

https://ant.design/components/tooltip-cn#%E4%B8%BA%E4%BD%95%E6%9C%89%E6%97%B6%E5%80%99-hoc-%E7%BB%84%E4%BB%B6%E6%97%A0%E6%B3%95%E7%94%9F%E6%95%88

@afc163 afc163 closed this as completed Apr 8, 2019
@afc163 afc163 added the ❓FAQ issues would be discussed a lot label May 8, 2019
@afc163
Copy link
Member

afc163 commented May 8, 2019

#15528 (comment)

@awall

This comment was marked as resolved.

@naivefun
Copy link

naivefun commented Feb 6, 2022

One workaround is to wrap your custom element with HTML tag

<Popover content={}>
    <div className="inline-flex"><CustomComponent/></div>
</Popover>

The wrapper class could be display: contents but I didn't try myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓FAQ issues would be discussed a lot
Projects
None yet
Development

No branches or pull requests

5 participants