@brightspace-ui/core 2.180.7 → 2.180.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tooltip/tooltip.js +15 -15
- package/package.json +1 -1
@@ -582,18 +582,17 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
582
582
|
this._openDir = space.dir;
|
583
583
|
|
584
584
|
// Compute the x and y position of the tooltip relative to its target
|
585
|
-
let
|
586
|
-
let parentLeft;
|
585
|
+
let offsetTop, offsetLeft;
|
587
586
|
if (offsetParent && offsetParent.tagName !== 'BODY') {
|
588
|
-
const
|
589
|
-
|
590
|
-
|
587
|
+
const offsetRect = offsetParent.getBoundingClientRect();
|
588
|
+
offsetTop = offsetRect.top + offsetParent.clientTop - offsetParent.scrollTop;
|
589
|
+
offsetLeft = offsetRect.left + offsetParent.clientLeft - offsetParent.scrollLeft;
|
591
590
|
} else {
|
592
|
-
|
593
|
-
|
591
|
+
offsetTop = -document.documentElement.scrollTop;
|
592
|
+
offsetLeft = -document.documentElement.scrollLeft;
|
594
593
|
}
|
595
|
-
const top = targetRect.top -
|
596
|
-
const left = targetRect.left -
|
594
|
+
const top = targetRect.top - offsetTop;
|
595
|
+
const left = targetRect.left - offsetLeft;
|
597
596
|
|
598
597
|
let positionRect;
|
599
598
|
if (this._isAboveOrBelow()) {
|
@@ -699,18 +698,18 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
699
698
|
});
|
700
699
|
|
701
700
|
if (this.boundary && offsetParent) {
|
702
|
-
const
|
701
|
+
const offsetRect = offsetParent.getBoundingClientRect();
|
703
702
|
if (!isNaN(this.boundary.left)) {
|
704
|
-
spaceAround.left = Math.min(targetRect.left -
|
703
|
+
spaceAround.left = Math.min(targetRect.left - offsetRect.left - this.boundary.left, spaceAround.left);
|
705
704
|
}
|
706
705
|
if (!isNaN(this.boundary.right)) {
|
707
|
-
spaceAround.right = Math.min(
|
706
|
+
spaceAround.right = Math.min(offsetRect.right - targetRect.right - this.boundary.right, spaceAround.right);
|
708
707
|
}
|
709
708
|
if (!isNaN(this.boundary.top)) {
|
710
|
-
spaceAround.above = Math.min(targetRect.top -
|
709
|
+
spaceAround.above = Math.min(targetRect.top - offsetRect.top - this.boundary.top, spaceAround.above);
|
711
710
|
}
|
712
711
|
if (!isNaN(this.boundary.bottom)) {
|
713
|
-
spaceAround.below = Math.min(
|
712
|
+
spaceAround.below = Math.min(offsetRect.bottom - targetRect.bottom - this.boundary.bottom, spaceAround.below);
|
714
713
|
}
|
715
714
|
}
|
716
715
|
const isRTL = this.getAttribute('dir') === 'rtl';
|
@@ -729,8 +728,9 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
729
728
|
if (this.for) {
|
730
729
|
const targetSelector = `#${cssEscape(this.for)}`;
|
731
730
|
target = ownerRoot.querySelector(targetSelector);
|
732
|
-
target = target ||
|
731
|
+
target = target || ownerRoot?.host?.querySelector(targetSelector);
|
733
732
|
} else {
|
733
|
+
console.warn('<d2l-tooltip>: missing required attribute "for"');
|
734
734
|
const parentNode = this.parentNode;
|
735
735
|
target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.host : parentNode;
|
736
736
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "2.180.
|
3
|
+
"version": "2.180.8",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|