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

Tooltip not working in combination with Switch #1178

Open
danieldeichfuss opened this issue Feb 14, 2025 · 3 comments
Open

Tooltip not working in combination with Switch #1178

danieldeichfuss opened this issue Feb 14, 2025 · 3 comments
Labels

Comments

@danieldeichfuss
Copy link

Project Information

Cloudflare Integration Extensions

Feedback

I noticed that the Tooltip component doesn't have any effect when used for a Switch. It works fine when I test with a Button instead of a Switch.

@Jan-Eimertenbrink
Copy link
Member

Hey Daniel, a tooltip should primarily be used for interactive UI elements that require explanation – for example, icon buttons, where it helps provide better context for the user.

The design system Primer (GitHub) recommends:

  • Reserve tooltips for components like icon buttons.
  • Keep your tooltip text minimal.
  • Only include tooltips on other components as a last resort.
  • Never include tooltips on non-interactive components (div, span, p).

A switch has a label that already explains its function, so it usually doesn’t need a tooltip. I’m also not aware of any case where a switch has a tooltip. Do you have any examples? Or what use case do you have where the switch would need to support a tooltip?

@danieldeichfuss
Copy link
Author

Hi Jan, thank you for the infos. I get your point, but I can definitely see scenarios where a Tooltip would be helpful with a Switch for additional context. Since it is more complex than a button with its two states. The label helps but I can see benefits in describing/adding context to the state that the tooltip is in.

In our case the Switch looks like this. But it would be helpful to me, if we could explain to the user that the off state means that the mittwald nameservers are in use. Or maybe you have a better idea?

Image

But if that's now how you would want us to use it, maybe there could be a note in the docs that this component only works with buttons.

@Lisa18289
Copy link
Member

seems to be a bug in react aria: adobe/react-spectrum#7768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants