Skip to content

[ScrollArea] Handle visibility change and nesting #1598

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

Merged
merged 13 commits into from
Apr 15, 2025

Conversation

atomiks
Copy link
Contributor

@atomiks atomiks commented Mar 24, 2025

When using ScrollArea inside Select, all the wrappers need role="presentation" to not interfere with the listbox role.

Further, the thumb was not computed when the ScrollArea became visible, and incorrectly reset the scrollbar offset if it had no width/height (such as on hide/unmount).

https://deploy-preview-1598--base-ui.netlify.app/experiments/scroll-area/inside-select

@atomiks atomiks added the component: scroll area This is the name of the generic UI component, not the React module! label Mar 24, 2025
Copy link

netlify bot commented Mar 24, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 7c31bf9
🔍 Latest deploy log https://app.netlify.com/sites/base-ui/deploys/67fd082c68a6470008665c85
😎 Deploy Preview https://deploy-preview-1598--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 1, 2025
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 1, 2025
@michaldudak
Copy link
Member

There's an issue when the viewport is resized while the Select is open. Once the viewport edge reaches the thumb, the native scrollbar appears.

select-scroll.mov

@atomiks
Copy link
Contributor Author

atomiks commented Apr 7, 2025

@michaldudak updated - looks like that's just because overflow-y: auto is on .Popup in the experiment, but should be removed when using ScrollArea inside of it

@atomiks atomiks force-pushed the fix/scroll-area-hide-nesting branch from 608f838 to ffbbf54 Compare April 7, 2025 01:50
@michaldudak
Copy link
Member

@atomiks
Copy link
Contributor Author

atomiks commented Apr 14, 2025

@michaldudak I can't repro the first one on macOS with the scrollbars always visible setting - is it also visible on the current v1.0.0-alpha.7?

Second one, I can

@michaldudak
Copy link
Member

The second video shows alpha.7

@atomiks
Copy link
Contributor Author

atomiks commented Apr 14, 2025

@michaldudak Oh right, I thought you meant it was a second issue not recalculating the position. But it seems like they're related: because it doesn't recalculate the position it overflows the bottom and causes the main scrollbar to appear. Seems like that's due to the Content part being removed by default, and the ResizeObserver ends up bailing out of both the viewport and content nodes

@michaldudak
Copy link
Member

Sorry I wasn't clear enough! It seems to work well now. I'll do a final pass of the implementation now.

@atomiks atomiks merged commit a7e56eb into mui:master Apr 15, 2025
22 checks passed
@atomiks atomiks deleted the fix/scroll-area-hide-nesting branch April 15, 2025 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: scroll area This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants