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

fix: scrollbar gutters and dialog scrolling on open #1967

Merged

Conversation

KonnorRogers
Copy link
Collaborator

@KonnorRogers KonnorRogers commented Apr 8, 2024

Addresses comments in #1821

@CodingDoug here's a codepen from the preview branch that should show the scrollbar gutter working as expected.

https://codepen.io/paramagicdev/pen/rNbKmQE?editors=1010

Copy link

vercel bot commented Apr 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ✅ Ready (Inspect) Visit Preview Apr 11, 2024 5:38pm

Copy link
Member

@claviska claviska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The only time it seems to move is in Safari when Show Scroll Bars is set to "Always," but that's the expected edge case from previous conversations.

Do we need a changelog entry for this?

@KonnorRogers
Copy link
Collaborator Author

@claviska it shouldn't move in Safari with scroll bar always 🤔

@claviska
Copy link
Member

It's actually the fixed positioned things that are moving.

CleanShot.2024-04-11.at.09.49.03.mp4

@KonnorRogers
Copy link
Collaborator Author

@claviska this seems to be a limitation of fixed positioned elements with padding-right hacks. In theory you would need to do something like this to handle fixed elements shifting:

my-fixed-element {
  position: fixed;
  right: calc(30px - var(--sl-scroll-lock-size, 0px));
}

The good news is this only affects Safari because they do not support scrollbar-gutter: stable;

Bootstrap has the same issue:

https://codepen.io/paramagicdev/pen/xxezdKM

@KonnorRogers KonnorRogers merged commit a427433 into next Apr 11, 2024
2 checks passed
@KonnorRogers KonnorRogers deleted the konnorrogers/fix-dialog-scrolling-and-scroll-bar-gutters branch April 11, 2024 17:53
Comment on lines +9 to +12
scrollbar-gutter: var(--sl-scroll-lock-gutter) !important;
}

.sl-scroll-lock body {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a comment to the code, but by moving the overflow to the body, it prevents the "scroll to top" issue mentioned in #1951

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.

None yet

2 participants