Permalink
Browse files

fix(tooltip+popover): improve blur trigger handling

Better handling of focus moving between tip and element
  • Loading branch information...
tmorehouse committed Nov 17, 2017
1 parent d1658c1 commit c08b815266976564ba5ebb3eab3df0c05e6693db
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/utils/tooltip.class.js
@@ -644,17 +644,24 @@ class ToolTip {
this.enter(e);
} else if (type === 'focusout') {
// target is the element which is loosing focus
// And relatdTarget is the element gaining focus
if (target === $element && $tip && $tip.contains(relatedTarget)) {
// And relatedTarget is the element gaining focus
if ($tip && $element && $element.contains(target) && $tip.contains(relatedTarget)) {
// If focus moves from $element to $tip, don't trigger a leave
return;
}
if ($tip && target === $tip && $element.contains(relatedTarget)) {
if ($tip && $element && $tip.contains(target) && $element.contains(relatedTarget)) {
// If focus moves from $tip to $element, don't trigger a leave
// This will only happen during the whileOpen listeners
return;
}
// OPtherwise trigger a leave
if ($tip && $tip.contains(target) && $tip.contains(relatedTarget)) {
// If focus moves within $tip, don't trigger a leave
return;
}
if ($element && $element.contains(target) && $element.contains(relatedTarget)) {
// If focus moves within $element, don't trigger a leave
return;
}
// Otherwise trigger a leave
this.leave(e);
} else if (type === 'mouseleave') {
this.leave(e);

0 comments on commit c08b815

Please sign in to comment.