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

Remove layout shift on popup open #37

Merged
merged 7 commits into from
Oct 19, 2024

Conversation

phucbm
Copy link
Member

@phucbm phucbm commented Oct 19, 2024

This pull request includes several changes to improve the handling of custom scrollbars and prevent page jumping when a popup is shown. It introduces new options, refactors existing code, and updates documentation.

Enhancements and New Features:

  • src/configs.js: Added scrollbarWidth option to allow manual setting of scrollbar width to avoid page jumping when a popup is shown.
  • src/utils/getScrollbarWidth.js: Implemented a new utility function to calculate scrollbar width, with support for manual override via the scrollbarWidth option.
  • src/utils/isMobile.js: Added a utility function to detect mobile devices, ensuring the scrollbar width is set to 0 on touch screens.

Code Refactoring:

  • src/_index.js: Refactored to use the new getScrollbarWidth utility function and moved the function import to the appropriate file. [1] [2]
  • src/helpers.js: Removed the old getScrollbarWidth function, as it has been replaced by the new utility.

Documentation Updates:

  • dev/md/options.md: Updated the options documentation to include the new scrollbarWidth attribute.
  • dev/md/faq.md: Added a new FAQ section explaining how to fix page jumping when a popup is shown, including examples of custom scrollbar CSS and Easy Popup options.

Frontend Enhancements:

@phucbm phucbm changed the title Staging fix jumping scrollbar on open Fix jumping scrollbar on open Oct 19, 2024
@phucbm phucbm added the enhancement New feature or request label Oct 19, 2024
@phucbm phucbm self-assigned this Oct 19, 2024
@phucbm phucbm changed the title Fix jumping scrollbar on open Fix layout shift on popup open Oct 19, 2024
@phucbm phucbm changed the title Fix layout shift on popup open Remove layout shift on popup open Oct 19, 2024
@phucbm phucbm merged commit 1e947a8 into staging Oct 19, 2024
@phucbm phucbm deleted the staging-fix-jumping-scrollbar-on-open branch October 19, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant