Skip to content
Permalink
Browse files
fix(tooltip, popover): check document.body instead of document fo…
…r IE11 support (fixes #4074) (#4075)

* fix(tooltip, popover): check `document.body` instead of `document` for IE11 support (fixes #4074)

* lint
  • Loading branch information
tmorehouse authored and jacobmllr95 committed Sep 11, 2019
1 parent de6e229 commit 1eda4fe8b13690a12735404924295c8be4800e05
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/components/tooltip/helpers/bv-tooltip.js
@@ -12,6 +12,7 @@ import {
isDisabled,
isVisible,
closest,
contains,
select,
getById,
hasClass,
@@ -204,7 +205,7 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

this.$nextTick(() => {
const target = this.getTarget()
if (target && document.contains(target)) {
if (target && contains(document.body, target)) {
// Copy the parent's scoped style attribute
this.scopeId = getScopId(this.$parent)
// Set up all trigger handlers and listeners
@@ -353,7 +354,12 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
// Show the tooltip
const target = this.getTarget()

if (!target || !document.body.contains(target) || !isVisible(target) || this.dropdownOpen()) {
if (
!target ||
!contains(document.body, target) ||
!isVisible(target) ||
this.dropdownOpen()
) {
// If trigger element isn't in the DOM or is not visible, or is on an open dropdown toggle
return
}
@@ -783,13 +789,13 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
/* istanbul ignore next */
if (
// From tip to target
(tip && tip.contains(evtTarget) && target.contains(relatedTarget)) ||
(tip && contains(tip, evtTarget) && contains(target, relatedTarget)) ||
// From target to tip
(tip && target.contains(evtTarget) && tip.contains(relatedTarget)) ||
(tip && contains(target, evtTarget) && contains(tip, relatedTarget)) ||
// Within tip
(tip && tip.contains(evtTarget) && tip.contains(relatedTarget)) ||
(tip && contains(tip, evtTarget) && contains(tip, relatedTarget)) ||
// Within target
(target.contains(evtTarget) && target.contains(relatedTarget))
(contains(target, evtTarget) && contains(target, relatedTarget))
) {
// If focus/hover moves within `tip` and `target`, don't trigger a leave
return

0 comments on commit 1eda4fe

Please sign in to comment.