Tooltip is not triggered when `title` prop has value
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
- Go to https://codesandbox.io/s/vigorous-tesla-1ugd31?file=/src/App.js
- Type “x”
- You can see from the
console.log()
that the currenttitle
prop isundefined
- Type
backspace
to remove “x” - From the
console.log()
, now the currenttitle
prop is"Required field"
What is expected?
The Tooltip should be displayed with the message Required field
since at step 5 there are trigger="focus"
and title="Required field"
props on Tooltip.
What is actually happening?
Tooltip is not displayed
Environment | Info |
---|---|
antd | 4.18.8 |
React | 17.0.2 |
System | Mac OS 12.1 |
Browser | Firefox 96 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Material UI tooltip doesn't display on custom component ...
As far as I can tell, I am doing about the simplest implementation of the tooltip component: I import it directly (no custom...
Read more >React Tooltip component - Material UI - MUI
The tooltip is normally shown immediately when the user's mouse hovers over the element, and hides immediately when the user's mouse leaves. A...
Read more >FAQ | Tippy.js - GitHub Pages
The title attribute should be removed once you have its content so the browser's default tooltip isn't displayed along with the tippy. #Plugin....
Read more >rc-tooltip - npm
Start using rc-tooltip in your project by running `npm i rc-tooltip`. ... require('react-dom'); // By default, the tooltip has no style.
Read more >Tooltip - React Spectrum Libraries - Adobe
The TooltipTrigger accepts exactly two children: the element which triggers the display of the Tooltip and the Tooltip itself. The trigger element must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it.
To workaround this issue, we need to implement
isFocusing
state and use it to controlvisible
of Tooltip ourself. The following is my implementation, thanks @kanweiwei for the idea.codesandbox: https://codesandbox.io/s/wonderful-vaughan-x3ovxd?file=/src/App.js
@kanweiwei answer the question. trigger is trigger, dynamic change
title
do not triggerfocus
again sincefocus
is only fire once when get focused.