pull/5453/merge
Veeraishvwajith 2 days ago committed by GitHub
commit 3473e03824
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -117,8 +117,13 @@ export function useBodyScrollLock(): WritableComputedRef<boolean> {
const isLocked = shallowRef(false) const isLocked = shallowRef(false)
let useEvents = false let useEvents = false
let scrollY = 0
function lock() { function lock() {
if (isLocked.value) return if (isLocked.value) return
scrollY = window.scrollY
useEvents = useEvents =
window.innerWidth > document.documentElement.clientWidth && window.innerWidth > document.documentElement.clientWidth &&
!CSS.supports('scrollbar-gutter', 'stable') !CSS.supports('scrollbar-gutter', 'stable')
@ -130,6 +135,8 @@ export function useBodyScrollLock(): WritableComputedRef<boolean> {
if (!isLocked.value) return if (!isLocked.value) return
useEvents ? unlockEvents() : unlockOverflow() useEvents ? unlockEvents() : unlockOverflow()
isLocked.value = false isLocked.value = false
window.scrollTo(0, scrollY)
} }
onScopeDispose(unlock) onScopeDispose(unlock)

@ -621,3 +621,7 @@
content: '\2060'; content: '\2060';
color: currentColor; color: currentColor;
} }
html {
scrollbar-gutter: stable;
}

Loading…
Cancel
Save