ux: tooltip should not show when click the button when use delay
See original GitHub issueIssue description
- components:
tooltip
- reactstrap version
4.0.0
- import method
not sure
- react version
16.2.0
- bootstrap version
5.0.0 beta 2
What is happening?
I am using delay
to show tooltip after 2s. However, now when I click the button immediately, it also shows the tooltip.
It happens to both Tooltip
and UncontrolledTooltip
.
It is just a user experience issue, not really a bug.
Code
<kbd>Live demo</kbd>
constructor(props) {
super(props);
this.state = {
isTooltipOpen: false
};
}
onToggleTooltip = () => {
const { isTooltipOpen } = this.state;
this.setState({ isTooltipOpen: !isTooltipOpen });
};
render() {
const { isTooltipOpen } = this.state;
return (
<div>
<button id="controlledTooltip">Controlled Tooltip</button>
<button id="uncontrolledTooltip">Uncontrolled Tooltip</button>
<Tooltip
delay={{ show: 2000, hide: 0 }}
isOpen={isTooltipOpen}
placement="bottom"
target="controlledTooltip"
toggle={this.onToggleTooltip}
>
Discard draft
</Tooltip>
<UncontrolledTooltip
placement="bottom"
target="uncontrolledTooltip"
delay={{ show: 2000, hide: 0 }}
>
Hello world!
</UncontrolledTooltip>
</div>
);
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How long should the delay be before a tooltip pops up?
Moving the mouse over a few buttons would immediately show the tooltips. We settled on a 1 second delay as this is slow...
Read more >Delay before the tooltip shows up - UX Pickle
UX designers have introduced the delay before a tooltip shows up to make sure that the user actually wants to see the tooltip....
Read more >Tooltip Guidelines - Nielsen Norman Group
If tooltips are erratically displayed throughout your site, people may never discover them. It's important to be consistent and provide tooltips ...
Read more >How to not show tooltip when click the button immediately?
When I click the button immediately, I don't want it be shown. But right now when I click the button immediately, it shows...
Read more >How to use and design a Tooltip that helps the user - UX Planet
Tooltips are sometimes used to show truncated text in apps. It is normal to see a 3 dot (or an ellipsis) if there...
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 Free
Top 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
We currently have a click/touch listener which will toggle the tooltip if it is not showing https://github.com/reactstrap/reactstrap/blob/c89bdea5ca7b90641708438c2415463996f2ab76/src/Tooltip.js#L140-L150
I think this is mostly for touch screens, but it probably should still honor the delay. We should probably change it to call this.onMouseOverTooltip() instead of this.toggle()
^8.2.0 introduced a side effect that not if you want to get the desired behavior you will additionally need to pass
trigger="click hover focus"
to the tooltip.