Skip to content

fix(dialog): scrollbar Flash on opening #5121 #5802

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dialog/internal/_dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
// space from appearing on platforms that reserve scrollbar space.
// Note: we only scroll vertically. Horizontal scrolling should be handled
// by the content.
overflow-y: scroll;
overflow-y: auto;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand correctly, this works by not forcing the scrollbar to show (auto vs scroll) if we detect overflowing content in JS and add the .scrollable class?

What is the advantage to this solution as opposed to addressing the issue in JS that results in an inaccurate toggling of the .scrollable class?

For example, toggling the class after open animations have settled as suggested in #5121 (comment).

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you understand correctly.

I suppose ive always been drilled on doing css over js but I can see your point, especially since there are open and close methods already.

Will do this in js 👍

}

.content {
Expand All @@ -185,6 +185,7 @@
font-weight: map.get($tokens, 'supporting-text-weight');
height: min-content; // Needed for Safari
position: relative;
overflow-y: clip; // Needed for .scrollable .scroller
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is overflow-y: clip vs the default overflow-y: visible needed for the scroller?

Copy link
Author

Choose a reason for hiding this comment

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

Not too sure on that actually... .content overflows when scroller is set to auto, so this prevents that. This would make more sense in a .scrollable > .content but as mentioned above ill go do this in js

}

slot[name='content']::slotted(*) {
Expand Down