@johly/bits-ui 2.18.5 → 2.18.7
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.
|
@@ -80,6 +80,21 @@
|
|
|
80
80
|
measureFrame = null;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
function getNearestScrollableAncestor(target: HTMLElement, boundary: HTMLElement) {
|
|
84
|
+
let node: HTMLElement | null = target.parentElement;
|
|
85
|
+
while (node && boundary.contains(node)) {
|
|
86
|
+
if (node.scrollHeight - node.clientHeight > 1) {
|
|
87
|
+
const overflowY = node.ownerDocument.defaultView?.getComputedStyle(node).overflowY;
|
|
88
|
+
if (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") {
|
|
89
|
+
return node;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (node === boundary) break;
|
|
93
|
+
node = node.parentElement;
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
83
98
|
function measureListAlign() {
|
|
84
99
|
measureFrame = null;
|
|
85
100
|
if (align !== "list" || (side !== "right" && side !== "left")) {
|
|
@@ -101,7 +116,8 @@
|
|
|
101
116
|
return;
|
|
102
117
|
}
|
|
103
118
|
const rowRect = firstRow.getBoundingClientRect();
|
|
104
|
-
|
|
119
|
+
const scroller = getNearestScrollableAncestor(firstRow, contentNode);
|
|
120
|
+
listAlignOffset = Math.round(contentRect.top - rowRect.top - (scroller?.scrollTop ?? 0));
|
|
105
121
|
}
|
|
106
122
|
|
|
107
123
|
function queueMeasureListAlign() {
|