@zag-js/dialog
Advanced tools
Comparing version 0.0.0-dev-20220422172147 to 0.0.0-dev-20220424123138
@@ -201,6 +201,10 @@ var __create = Object.create; | ||
function preventScrollStandard() { | ||
const fn = pipe(setStyle(docEl, "paddingRight", `${win.innerWidth - docEl.clientWidth}px`), setStyle(docEl, "overflow", "hidden")); | ||
return () => fn == null ? void 0 : fn(); | ||
if (docEl.hasAttribute("scroll-lock")) | ||
return; | ||
const fn = pipe(setStyle(docEl, "paddingRight", `${win.innerWidth - docEl.clientWidth}px`), setStyle(docEl, "overflow", "hidden"), () => docEl.setAttribute("scroll-lock", "true")); | ||
return pipe(fn, () => docEl.removeAttribute("scroll-lock")); | ||
} | ||
function preventScrollMobileSafari() { | ||
if (docEl.hasAttribute("scroll-lock")) | ||
return; | ||
let scrollable; | ||
@@ -269,3 +273,3 @@ let lastY = 0; | ||
win.scrollTo(0, 0); | ||
let removeEvents = pipe(addDomEvent(doc, "touchstart", onTouchStart, { passive: false, capture: true }), addDomEvent(doc, "touchmove", onTouchMove, { passive: false, capture: true }), addDomEvent(doc, "touchend", onTouchEnd, { passive: false, capture: true }), addDomEvent(doc, "focus", onFocus, true), addDomEvent(win, "scroll", onWindowScroll)); | ||
let removeEvents = pipe(addDomEvent(doc, "touchstart", onTouchStart, { passive: false, capture: true }), addDomEvent(doc, "touchmove", onTouchMove, { passive: false, capture: true }), addDomEvent(doc, "touchend", onTouchEnd, { passive: false, capture: true }), addDomEvent(doc, "focus", onFocus, true), addDomEvent(win, "scroll", onWindowScroll), () => docEl.setAttribute("scroll-lock", "true")); | ||
return () => { | ||
@@ -275,2 +279,3 @@ restoreStyles(); | ||
win.scrollTo(scrollX, scrollY); | ||
docEl.removeAttribute("scroll-lock"); | ||
}; | ||
@@ -277,0 +282,0 @@ } |
{ | ||
"name": "@zag-js/dialog", | ||
"version": "0.0.0-dev-20220422172147", | ||
"version": "0.0.0-dev-20220424123138", | ||
"description": "Core logic for the dialog widget implemented as a state machine", | ||
@@ -32,5 +32,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/core": "^0.0.0-dev-20220422172147", | ||
"@zag-js/dom-utils": "^0.0.0-dev-20220422172147", | ||
"@zag-js/types": "^0.0.0-dev-20220422172147", | ||
"@zag-js/core": "^0.0.0-dev-20220424123138", | ||
"@zag-js/dom-utils": "^0.0.0-dev-20220424123138", | ||
"@zag-js/types": "^0.0.0-dev-20220424123138", | ||
"aria-hidden": "^1.1.3", | ||
@@ -37,0 +37,0 @@ "focus-trap": "^6.7.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
215478
1343