mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
fix(ToolTip): ensure at most one ToolTip is open at the same time
- a click event closes the tooltip if the target is not the tooltip or the tooltip icon. - the event is registered in the capture phase and a `setTimeout` is used to deal with edge cases in which a button is used to toggle the tooltip on or off.
This commit is contained in:
parent
23c1035186
commit
028ebdf391
1 changed files with 7 additions and 0 deletions
|
@ -184,6 +184,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}"
|
}}"
|
||||||
|
on:click|capture="{({ target }) => {
|
||||||
|
if (open && !ref.contains(target) && !refTooltip.contains(target)) {
|
||||||
|
setTimeout(() => {
|
||||||
|
open = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue