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:
Paweł Malinowski 2021-11-06 11:48:06 +01:00
commit 028ebdf391

View file

@ -184,6 +184,13 @@
}
}
}}"
on:click|capture="{({ target }) => {
if (open && !ref.contains(target) && !refTooltip.contains(target)) {
setTimeout(() => {
open = false;
});
}
}}"
/>
<div