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.

Tooltip for Icon Button stays visible after button is clicked and mouse moves away

See original GitHub issue

Tooltip for Icon Button stays visible when button is clicked

  • carbon-components
  • carbon-components-react

Detailed description

When an Icon Button is clicked, the tooltip stays visible even when the mouse is moved away from the button. This happens since the button has focus, but it looks very odd to the user. I would expect for the tooltip to go away once the button is clicked.

What browser are you working in? Chrome / Firefox / IE / Edge

What version of the Carbon Design System are you using? carbon-components-react 7.17.0

What offering/product do you work on? Any pressing ship or release dates we should be aware of? Part of the Cognos Analytics offering with a release of end of October.

Steps to reproduce the issue

This behaviour can be seen in the Carbon sample for the Icon Button https://react.carbondesignsystem.com/?path=/story/button--icon-button

  1. Click on the button icon
  2. Move your mouse away from the button

BUG: The tooltip is still visible.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mduplscommented, Nov 19, 2020

One aspect that isn’t being discussed here and is what makes this truly feel like a bug is:

Position at least two buttons next to each other in such a way that if both of the tooltips are visible at the same time, they overlap with each other. With the current design, this is possible. Click on one button and then hover over the second button. You now have two visible tooltips that overlap.

How do we prevent this situation from happening?

3reactions
carmacleodcommented, Nov 28, 2020

Please don’t just add a timeout - it’s a bit more complicated than that. The “persistence” thing is a WCAG 2.1 requirement, which is relatively new (IBM began requiring WCAG 2.1 about a year ago), so it’s not well understood yet.

I believe there is some “interpretation wiggle room”, though, that would make for better UX and still meet the WCAG requirement.

What you can do is:

  • when the tooltip is triggered by focus, then it should be dismissed when focus is removed (or if a different tooltip is triggered by hover)
  • when the tooltip is triggered by hover, then it should be dismissed when hover is removed (even if the button still has focus)

Here’s the example code for Sarah’s excellent article Tooltips in the time of WCAG 2.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap's tooltip doesn't disappear after button click ...
This is because trigger is not set. The default value for trigger is 'hover focus' , thus the tooltip stay visible after a...
Read more >
About Tooltip Controls - Win32 apps | Microsoft Learn
The tooltip appears near the pointer and disappears when the user clicks a mouse button, moves the pointer away from the tool, or...
Read more >
Tooltip – Carbon Design System
A tooltip is a message box that is displayed when a user hovers over or gives focus to a UI element. The tool...
Read more >
ARIA: tooltip role - Accessibility - MDN Web Docs - Mozilla
The tooltip is displayed and disappears via keyboard focus and removal of focus and by the mouse events - mousing over and mousing...
Read more >
JavaScript · Bootstrap
Don't use data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a...
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