question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ux: tooltip should not show when click the button when use delay

See original GitHub issue

Issue 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TheSharpieOnecommented, Mar 19, 2018

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()

0reactions
GoPro16commented, Feb 26, 2020

^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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found