Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/pretty-drinks-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Fixed modal scroll bug
98 changes: 64 additions & 34 deletions polaris-react/src/components/Modal/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Checkbox,
ChoiceList,
DropZone,
Form,
FormLayout,
Modal,
Stack,
Expand Down Expand Up @@ -490,29 +489,44 @@ export function WithLongContent() {
title="Long form modal"
open
onClose={() => {}}
sectioned
primaryAction={{content: 'Save'}}
>
<Banner title="Heyo" />
<Form onSubmit={() => {}}>
<Modal.Section>
<Banner title="Payment details" />
</Modal.Section>
<Modal.Section>
<FormLayout>
<FormLayout.Group>
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="Payment method type" autoComplete="off" />
<TextField label="Card number" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Expires" autoComplete="off" />
<TextField label="CVV" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Country/region" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="First name" autoComplete="off" />
<TextField label="Last name" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Address" autoComplete="off" />
<TextField label="Apartment, suite, etc." autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="City" autoComplete="off" />
<TextField label="Province" autoComplete="off" />
<TextField label="Postal code" autoComplete="off" />
</FormLayout.Group>
</FormLayout>
<FormLayout>
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
</FormLayout>
</Form>
</Modal.Section>
</Modal>
);
}
Expand All @@ -527,26 +541,42 @@ export function WithLongContentNoScroll() {
noScroll
primaryAction={{content: 'Save'}}
>
<Banner title="Heyo" />
<Form onSubmit={() => {}}>
<Modal.Section>
<Banner title="Payment details" />
</Modal.Section>
<Modal.Section>
<FormLayout>
<FormLayout.Group>
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="Payment method type" autoComplete="off" />
<TextField label="Card number" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Expires" autoComplete="off" />
<TextField label="CVV" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Country/region" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="First name" autoComplete="off" />
<TextField label="Last name" autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="Address" autoComplete="off" />
<TextField label="Apartment, suite, etc." autoComplete="off" />
</FormLayout.Group>

<FormLayout.Group>
<TextField label="City" autoComplete="off" />
<TextField label="Province" autoComplete="off" />
<TextField label="Postal code" autoComplete="off" />
</FormLayout.Group>
</FormLayout>
<FormLayout>
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
<TextField label="URL" type="url" autoComplete="url" />
</FormLayout>
</Form>
</Modal.Section>
</Modal>
);
}
4 changes: 3 additions & 1 deletion polaris-react/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ export const Modal: React.FunctionComponent<ModalProps> & {
);

const scrollContainerMarkup = noScroll ? (
<Box width="100%">{body}</Box>
<Box width="100%" overflowX="hidden">
Copy link
Member Author

Choose a reason for hiding this comment

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

{body}
</Box>
) : (
<Scrollable
shadow
Expand Down