@primer/behaviors 1.3.3 → 1.3.4
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.
|
@@ -26,6 +26,8 @@ function getAnchoredPosition(floatingElement, anchorElement, settings = {}) {
|
|
|
26
26
|
}
|
|
27
27
|
exports.getAnchoredPosition = getAnchoredPosition;
|
|
28
28
|
function getPositionedParent(element) {
|
|
29
|
+
if (isOnTopLayer(element))
|
|
30
|
+
return document.body;
|
|
29
31
|
let parentNode = element.parentNode;
|
|
30
32
|
while (parentNode !== null) {
|
|
31
33
|
if (parentNode instanceof HTMLElement && getComputedStyle(parentNode).position !== 'static') {
|
|
@@ -35,6 +37,20 @@ function getPositionedParent(element) {
|
|
|
35
37
|
}
|
|
36
38
|
return document.body;
|
|
37
39
|
}
|
|
40
|
+
function isOnTopLayer(element) {
|
|
41
|
+
if (element.tagName === 'DIALOG') {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
if (element.matches(':popover-open')) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
38
54
|
function getClippingRect(element) {
|
|
39
55
|
let parentNode = element;
|
|
40
56
|
while (parentNode !== null) {
|
|
@@ -22,6 +22,8 @@ export function getAnchoredPosition(floatingElement, anchorElement, settings = {
|
|
|
22
22
|
return pureCalculateAnchoredPosition(clippingRect, relativeRect, floatingElement.getBoundingClientRect(), anchorElement instanceof Element ? anchorElement.getBoundingClientRect() : anchorElement, getDefaultSettings(settings));
|
|
23
23
|
}
|
|
24
24
|
function getPositionedParent(element) {
|
|
25
|
+
if (isOnTopLayer(element))
|
|
26
|
+
return document.body;
|
|
25
27
|
let parentNode = element.parentNode;
|
|
26
28
|
while (parentNode !== null) {
|
|
27
29
|
if (parentNode instanceof HTMLElement && getComputedStyle(parentNode).position !== 'static') {
|
|
@@ -31,6 +33,20 @@ function getPositionedParent(element) {
|
|
|
31
33
|
}
|
|
32
34
|
return document.body;
|
|
33
35
|
}
|
|
36
|
+
function isOnTopLayer(element) {
|
|
37
|
+
if (element.tagName === 'DIALOG') {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
if (element.matches(':popover-open')) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (_a) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
34
50
|
function getClippingRect(element) {
|
|
35
51
|
let parentNode = element;
|
|
36
52
|
while (parentNode !== null) {
|