diff --git a/src/Tooltip/Tooltip.svelte b/src/Tooltip/Tooltip.svelte index ca6076fa..3f2bd110 100644 --- a/src/Tooltip/Tooltip.svelte +++ b/src/Tooltip/Tooltip.svelte @@ -68,8 +68,6 @@ const dispatch = createEventDispatcher(); - let programmatic = true; - function onKeydown(e) { if (e.key === "Escape") { e.stopPropagation(); @@ -88,15 +86,9 @@ } function openMenu() { - programmatic = false; open = true; } - function closeMenu() { - programmatic = false; - open = false; - } - afterUpdate(() => { if (open) { const button = ref.getBoundingClientRect(); @@ -167,8 +159,14 @@ { + if (open && target.contains(refTooltip)) { + if (refIcon) { + refIcon.focus(); + } else if (ref) { + ref.focus(); + } + open = false; } }}" /> @@ -206,7 +204,6 @@