-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update modal.css #2956
Update modal.css #2956
Conversation
When opening a modal window, the scrollbar disappears, but the content shifts This padding automatically shifts the content to the left so that the user does not notice the content moving when the scrollbar disappears Padding is equal to the standard scrollbar width
Can you use scrollbar-gutter instead? Padding will be applied to all operating systems including iOS, Android, MacOS where scrollbars don't take any space. We would only need that spacing in operating systems which dedicate a 15px space for scrollbars. Also it may not be always 15px based on user settings. CSS scrollbar-gutter takes care of the size as well. |
Added scrollbar-gutter
Yeah, you are absolutely right! 👍 |
It looks like this now shifts the content to the left on pages with no scrollbar |
If i don't want to show the scrollbar, what should I do? |
I experience the same problem as @TreyRuffy I think it's a bug introduced with this change. No page is shifted to the left! @saadeghi /* app.css */
@layer base {
:root:has(:is(.modal-open, .modal:target, .modal-toggle:checked + .modal, .modal[open])) {
scrollbar-gutter: revert !important;
}
} |
This gave me a headache! I don't see the benefit for this behavior by default. But thanks @gremo ❤️ |
Having the Modal component change the styling of the root element on the assumption that a scrollbar is present is problematic and bound to result in unwanted behavior. |
When opening a modal window, the scrollbar disappears, but the content shifts
This padding automatically shifts the content to the left so that the user does not notice the content moving when the scrollbar disappears
Padding is equal to the standard scrollbar width