@johly/vaul-svelte 1.0.0-next.21 → 1.0.0-next.22
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.
|
@@ -65,6 +65,8 @@ export function useDrawerRoot(opts) {
|
|
|
65
65
|
return;
|
|
66
66
|
if (drawerNode && !drawerNode.contains(event.target))
|
|
67
67
|
return;
|
|
68
|
+
if (hasNestedOpen)
|
|
69
|
+
return;
|
|
68
70
|
const target = event.target;
|
|
69
71
|
if (target.hasAttribute("data-vaul-no-drag") || target.closest("[data-vaul-no-drag]")) {
|
|
70
72
|
return;
|
|
@@ -73,7 +75,6 @@ export function useDrawerRoot(opts) {
|
|
|
73
75
|
drawerWidth = drawerNode?.getBoundingClientRect().width || 0;
|
|
74
76
|
isDragging = true;
|
|
75
77
|
dragStartTime = new Date();
|
|
76
|
-
drawerNode?.classList.add(DRAG_CLASS);
|
|
77
78
|
// iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging
|
|
78
79
|
if (isIOS()) {
|
|
79
80
|
on(window, "touchend", () => (isAllowedToDrag = false), { once: true });
|
|
@@ -171,6 +172,7 @@ export function useDrawerRoot(opts) {
|
|
|
171
172
|
}
|
|
172
173
|
if (!isAllowedToDrag && !shouldDrag(event.target, isDraggingInDirection))
|
|
173
174
|
return;
|
|
175
|
+
drawerNode.classList.add(DRAG_CLASS);
|
|
174
176
|
isAllowedToDrag = true;
|
|
175
177
|
set(drawerNode, {
|
|
176
178
|
transition: "none",
|
|
@@ -234,7 +236,7 @@ export function useDrawerRoot(opts) {
|
|
|
234
236
|
if (!opts.open.current)
|
|
235
237
|
return;
|
|
236
238
|
const preventScrollDuringDrag = (e) => {
|
|
237
|
-
if (
|
|
239
|
+
if (isAllowedToDrag && !hasNestedOpen) {
|
|
238
240
|
e.preventDefault();
|
|
239
241
|
}
|
|
240
242
|
};
|