New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: body scroll remains locked if open dialog from another dialog using v-if
#474
Comments
Small observation
const rootContext = injectDialogRootContext()
- const isLocked = useBodyScrollLock()
+ const isLocked = useBodyScrollLock(rootContext.open.value)
watch(
rootContext.open,
(isOpen) => {
isLocked.value = isOpen
},
- { immediate: true },
)
if (stack.value === 0) {
document.body.style.paddingRight = ''
document.body.style.marginRight = ''
document.body.style.pointerEvents = ''
document.body.style.removeProperty('--scrollbar-width')
+ nextTick(() => {
+ document.body.style.overflow = ''
+ })
} Looks like |
@zernonia Could you please share your thoughts? I'm not sure if this should be handled by radix-vue or in userland. |
Thanks for the issue @enkot . I just tested the link above and cant seems to reproduce it 🤔 Screen.Recording.2023-11-01.at.9.37.55.PM.mov |
@zernonia Sorry, the repro was incorrect, updated it. Could you please check one more time?) |
I've spend some time looking into this.. I believe it's due to useScrollLock internally checking the I've tried using dialogBOpen.value = false
nextTick(() => {
dialogAOpen.value = true
}) It's abit challenging to tackle 😅 |
Yep, already using |
@zernonia do you plan to upgrade VueUse to ^10.6.0? |
I did a refactor here #516, (which drop the Could you check if you use case is fixed too? 😁 |
@zernonia Yes, now it works! Thank you 💚 |
Environment
Link to minimal reproduction
https://codesandbox.io/p/sandbox/radix-vue-select-forked-4yf8xy?file=%2Fsrc%2FApp.vue%3A1%2C1
Steps to reproduce
Describe the bug
Found another bug with body scroll :) My use case is not very common, I need to open/close dialogs using
v-if
(in real project it is handled by createTemplatePromise).Body scroll remains locked if open dialog B from another dialog A, then open again dialog A from dialog B.
overflow: hidden;
remains on body after closing the last dialog (B).Expected behavior
Page scroll works
Conext & Screenshots (if applicable)
Partially it is a regression from my previous fix #456 🙈 , but I think it should work in all scenarios anyway:)
The text was updated successfully, but these errors were encountered: