-
Notifications
You must be signed in to change notification settings - Fork 536
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
Support overflow scrolling in ActionMenu #3926
Conversation
🦋 Changeset detectedLatest commit: b831070 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
Closing in favor of primer/view_components#2383 |
Re-opening, I meant to close a different PR 😄 |
Same! Are there any risks in doing that? (for example: Overlays that suddenly have an unexpected scroll?) If we feel more confident, we can enable it just for primer components that internally use Overlay like ActionMenu, Autocomplete, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Left a non blocking comment that we can look at in follow up PR
@siddharthkp this is the exact thing I want to be cautious about. I agree, we can merge this basic step for now to unblock anyone who needs to enable scrolling but we can revisit to make the DX a little better. Thanks! |
src/Overlay/Overlay.tsx
Outdated
@@ -64,7 +65,7 @@ const StyledOverlay = styled.div<StyledOverlayProps>` | |||
max-height: ${props => props.maxHeight && heightMap[props.maxHeight]}; | |||
width: ${props => widthMap[props.width || 'auto']}; | |||
border-radius: 12px; | |||
overflow: hidden; | |||
${props => (props.overflow ? `overflow: ${props.overflow};` : '')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized we should probably retain the existing overflow behavior if the prop isn't provided so that we don't cause any unexpected side effects. I'll push up a fix for that.
@siddharthkp 👋 would you mind taking another look at this PR? I was about to merge it when I realized that this changed the default overflow behavior of Overlay, which was not intentional. Let me know if the current diff looks good to merge now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! ✨
Closes #3486
When looking into #3486, it occurred to me that while we support passing a
maxHeight
prop, we don't enable overflow scrolling when that prop is provided.This PR adds an optional
overflow
prop toOverlay
which allows developers to specify the overflow behavior of the menu.I think ideally we should automatically apply
overflow: auto
whenever a max height is set (or even for all ActionMenu instances) but at least for now this can unblock this use case without impacting existing usage of Overlay.Changelog
New
Changed
Removed
Rollout strategy
Testing & Reviewing
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.