-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Modal] add noScroll prop #4153
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
Conversation
|
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. |
|
🟢 This pull request modifies 3 files and might impact 3 other files. Details:All files potentially affected (total: 3)📄
|
| .Scrollable { | ||
| -webkit-overflow-scrolling: touch; | ||
| position: relative; | ||
| overflow: hidden; |
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 think we should just not render the Scrollable in the Modal when noScroll is present. Rather than changing the Scrollable in addition to the modal.
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.
Yeah good call, I was overthinking it. Scrollable has a shadow prop that makes some styles that I didn't want to repeat, but obviously if the content isn't scrollable then there's no need for a shadow.
src/components/Modal/Modal.scss
Outdated
| display: flex; | ||
| flex-grow: 1; | ||
| overflow-x: hidden; | ||
| overflow: hidden; |
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.
why does this need to be changed?
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.
Whoops, leftover change from my prev idea
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.
👍 LGTM
|
🎉 Thanks for your contribution to Polaris React! |
WHY are these changes introduced?
Needed to fix https://github.com/Shopify/core-issues/issues/23913
We're building a component that has its own sticky toolbar header, and then the main body content is wrapped in a
<ScrollableContainer>, so that's how the user scrolls through the modal contents. The problem is, if the browser window is short enough, it'll squish the modal contents such that an outer scrollbar appears, which belongs to Polaris's<Modal>. So we have an outer container and an internal container, each of which will only partially scroll the modal contents 😬You can see a video in the above issue.
WHAT is this pull request doing?
<Modal>component now has the propnoScrollwhich when true wraps the body content in adivinstead of theScrollablecomponent🎩 checklist
README.mdwith documentation changes