@likable-hair/svelte 4.0.16 → 4.0.17
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.
|
@@ -117,6 +117,7 @@ function calcScrollY(elem) {
|
|
|
117
117
|
}
|
|
118
118
|
return scroll;
|
|
119
119
|
}
|
|
120
|
+
let positionedAncestor = undefined;
|
|
120
121
|
$effect(() => {
|
|
121
122
|
if (open) {
|
|
122
123
|
if (!menuElement || !activator)
|
|
@@ -165,6 +166,11 @@ $effect(() => {
|
|
|
165
166
|
calculateMenuPosition({ activator, menuElement });
|
|
166
167
|
if (maxZIndex)
|
|
167
168
|
zIndex = maxZIndex + 2;
|
|
169
|
+
if (!!menuElement && !!activator) {
|
|
170
|
+
let elem = getPositionedAncestor(menuElement.parentElement);
|
|
171
|
+
positionedAncestor = elem == null ? undefined : elem;
|
|
172
|
+
calculateMenuPosition({ menuElement, activator });
|
|
173
|
+
}
|
|
168
174
|
}
|
|
169
175
|
});
|
|
170
176
|
$effect(() => {
|
|
@@ -205,14 +211,6 @@ $effect(() => {
|
|
|
205
211
|
});
|
|
206
212
|
}
|
|
207
213
|
});
|
|
208
|
-
let positionedAncestor = undefined;
|
|
209
|
-
$effect(() => {
|
|
210
|
-
if (!!menuElement && !!activator) {
|
|
211
|
-
let elem = getPositionedAncestor(menuElement.parentElement);
|
|
212
|
-
positionedAncestor = elem == null ? undefined : elem;
|
|
213
|
-
calculateMenuPosition({ menuElement, activator });
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
214
|
function getPositionedAncestor(elem, positions = ['fixed', 'absolute', 'sticky', 'relative']) {
|
|
217
215
|
if (!elem)
|
|
218
216
|
return null;
|