Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/components/tooltip/helpers/bv-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
isDisabled,
isVisible,
closest,
contains,
select,
getById,
hasClass,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down