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

feat(useFreezeScroll): add new hook & test & doc #2474

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dev-aly3n
Copy link

@dev-aly3n dev-aly3n commented Feb 11, 2024

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close: #2473

💡 Background and solution

React hook that freezes the scroll and removes the scrollbar from the browser window when it is active without any layout shift, for example, when a modal is opened.

It's very challenging to avoid layout shift when you remove the scrollbar from the window. Many UI libraries still face issues with this, experiencing layout shifts when they open a modal or freeze scroll in some way. After testing numerous approaches, I found an approach that avoids layout shifts while removing the scrollbar and freezing the scroll.

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@CLAassistant
Copy link

CLAassistant commented Feb 11, 2024

CLA assistant check
All committers have signed the CLA.

@dev-aly3n dev-aly3n marked this pull request as ready for review February 13, 2024 15:33
@liuyib
Copy link
Collaborator

liuyib commented Feb 27, 2024

@dev-aly3n Hi, aly3n. Your idea excites me a lot, but this PR hasn't solved the issues you described:

2024-02-27.20.00.47.mov

Can you do some more work to resolve? Thx.

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

Successfully merging this pull request may close these issues.

[RFC] useFreezeScroll
3 participants