Skip to content
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

[useScrollLock] cause enexpected behavior on Safari besides other browsers #2278

Closed
7 tasks done
Mister-Hope opened this issue Sep 30, 2022 · 5 comments
Closed
7 tasks done

Comments

@Mister-Hope
Copy link
Contributor

Mister-Hope commented Sep 30, 2022

Describe the bug

  • when in Chrome based browers, the useScrollLock only lock that element

  • when in safari, the useScrollLock locks elment and any elements in it.

I think this should be consider as a bug, and if this is not fixable, I do think we'd better add some warnings in docs.

Related to #1558

My case is that I am locking body to prevent page scroll, while trying to like an fix modal be able to scroll.

I am building a feature extactly like vitepress. See NavScreen Component:

image

This NavScreen component will lock body scroll, and try to let the modal scrollable. And vitepress itself is not using @vueuse, instead it use body-scroll-lock package. (See: https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/components/VPNavScreen.vue)

While I am trying to build a similar layout with useScrollLock, I am getting the same behavior with Chrome. But on Safari, the NavScreen Component is not scrollable:

image

You can try https://vuepress-theme-hope.github.io/v2/

I am sure the issue only appears in safari, and:

  • Switching vitepress NavScreen component to useScrollLock has same issues on Safari
  • Using body-scroll-lock in my theme works well on Safari like vitepress default theme

I can provide a real "minimal reproduction" and system info if you do need this.

Used Package Manager

pnpm

Validations

@robinscholz
Copy link
Contributor

Ran into the same bug with a current project. The modal that should be scrollable can’t be scrolled, as soon as the body scroll is locked.

@stale
Copy link

stale bot commented Dec 24, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 24, 2022
@dpschen
Copy link
Contributor

dpschen commented Dec 30, 2022

I have the same issue

@stale stale bot removed the stale label Dec 30, 2022
@stale
Copy link

stale bot commented Feb 28, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 28, 2023
@dpschen
Copy link
Contributor

dpschen commented Mar 1, 2023

For me this works now since #2699

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants