Commit 4f2c48f
fix: debounce prevented tooltip from closing
There was an issue where the tooltip would stay open after the cursor
had already left the anchor element. The issue would arise if:
- there are two tooltip anchors A and B (same tooltip ID)
- mouse goes over A to show the tooltip, user waits for tooltip to show
- mouse quickly (within 50ms) leaves A, goes over B, then leaves B.
The tooltip component applies debouncing on the show and hide events in
case e.g. an anchor is simultaneously focused and mouseovered. If the
second leave event occurred while that debounce was still active, it was
never processed.
This commit fixes the issue by making the show and hide debounce
functions reset each other. For example, if the hide debounce has an
active timeout, calling the debounced show function will now reset the
timeout of the hide debounce.
This solution still leaves the hide/show debounces effective against
double-show/double-hide.1 parent 2e59f10 commit 4f2c48f
2 files changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
376 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
377 | 391 | | |
378 | 392 | | |
379 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
0 commit comments