fix(Tooltip): fix two way binding in cases where icon is in focus (#895)

This commit is contained in:
Paweł Malinowski 2021-11-09 23:52:40 +01:00 committed by GitHub
commit 7e76cbc8a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,7 +73,7 @@
setContext("Tooltip", { tooltipOpen }); setContext("Tooltip", { tooltipOpen });
function onKeydown(e) { function onKeydown(e) {
if (e.key === "Escape") { if (e.key === "Escape" || e.key === "Tab") {
e.stopPropagation(); e.stopPropagation();
open = false; open = false;
} else if (e.key === " " || e.key === "Enter") { } else if (e.key === " " || e.key === "Enter") {
@ -206,7 +206,6 @@
aria-describedby="{tooltipId}" aria-describedby="{tooltipId}"
on:mousedown="{onMousedown}" on:mousedown="{onMousedown}"
on:focus="{onFocus}" on:focus="{onFocus}"
on:blur="{onBlur}"
on:keydown="{onKeydown}" on:keydown="{onKeydown}"
> >
<slot name="icon"> <slot name="icon">
@ -241,6 +240,7 @@
class:bx--tooltip--align-center="{align === 'center'}" class:bx--tooltip--align-center="{align === 'center'}"
class:bx--tooltip--align-start="{align === 'start'}" class:bx--tooltip--align-start="{align === 'start'}"
class:bx--tooltip--align-end="{align === 'end'}" class:bx--tooltip--align-end="{align === 'end'}"
on:keydown="{onKeydown}"
> >
<span class:bx--tooltip__caret="{true}"></span> <span class:bx--tooltip__caret="{true}"></span>
<div <div