# ui: Use hoverable tooltips for Badge component to fix tooltip behavior \(\#38387\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0a9023bce09daf889bc323fc14580a9ffec32b04)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0a9023bce09daf889bc323fc14580a9ffec32b04

Requested commit: 0a9023bce09daf889bc323fc14580a9ffec32b04

Commit: 0a9023bce09daf889bc323fc14580a9ffec32b04

Tree: a3ed0feb37322c4e9f37a939064309fb0aca4f38

Author: Devdatta Talele

Committer: GitHub

## Message

````
ui: Use hoverable tooltips for Badge component to fix tooltip behavior (#38387)

## Summary

Fixes #38362 - Privacy tooltip behavior issues in AI Setup onboarding

## Problem
The Privacy tooltip in AI Setup onboarding had incorrect behavior:
1. Tooltip remained visible after mouse left the Privacy button
2. Clicking the button didn't toggle tooltip properly
3. Clicking in intersection area between tooltip and button didn't work

## Root Cause
Badge component used `tooltip()` instead of `hoverable_tooltip()`,
causing:
- Immediate tooltip hiding when mouse left triggering element
- No support for tooltip content interaction
- Poor intersection area click handling

## Solution
**Single line change** in `crates/ui/src/components/badge.rs:61`:
```rust
// Before:
this.tooltip(move |window, cx| tooltip(window, cx))

// After:
this.hoverable_tooltip(move |window, cx| tooltip(window, cx))
```

## Technical Details
- Leverages existing GPUI `hoverable_tooltip()` infrastructure
- Enables 500ms grace period before tooltip hiding
- Allows hovering over tooltip content without disappearing
- Uses proper tooltip bounds detection for click handling
- Affects all Badge tooltips system-wide (positive improvement)
- Full backward compatibility - no API changes

## Test Plan
- [x] Hover over Privacy badge → tooltip appears
- [x] Move mouse away → tooltip stays visible for 500ms
- [x] Move mouse to tooltip content → tooltip remains visible
- [x] Click on tooltip content → properly handled
- [x] Move mouse completely away → tooltip hides after delay
- [x] Verify no regression in other Badge tooltip usage

Release Notes:

- N/A
````

## Parents

- [fb60f710e3410d092d0512b939d38571287ed2a4](https://git.cafe/gitcafe/zed/commit/fb60f710e3410d092d0512b939d38571287ed2a4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0a9023bce09daf889bc323fc14580a9ffec32b04?format=markdown)
