Skip to content

fix: make scrollable modal a separate prop rather than the default#2314

Open
Bracciata wants to merge 9 commits intodevelopfrom
fix/modal-changes
Open

fix: make scrollable modal a separate prop rather than the default#2314
Bracciata wants to merge 9 commits intodevelopfrom
fix/modal-changes

Conversation

@Bracciata
Copy link
Copy Markdown
Contributor

@Bracciata Bracciata commented Apr 8, 2026

This addresses a breaking change introduced in #2125.

Changes

  • Moves the scrollable modal behavior from the default to an opt-in scrollable boolean prop
  • Scopes max-height / overflow-y: auto CSS rules to .Modal--scrollable only
  • Non-scrollable modals revert to pre-Introduce modal max-height #2125 behavior (scrim scrolls when content overflows)
  • The scrollable prop is separate from variant, allowing composition with variant="info"
  • Reduces vertical offset from 6.25rem to 4rem for better use of available viewport space
  • Sets dialog z-index to 25 so modals render above the header
  • Adds documentation and an interactive example for the scrollable modal
  • Adds unit tests for the scrollable class and accessibility
  • Adds e2e screenshot tests and a keyboard scrolling test for scrollable modals

Migration

If you were relying on the scrollable-by-default behavior introduced in #2125, add the scrollable prop to your Modal:

- <Modal show>
+ <Modal show scrollable>

The scrollable prop can also be combined with variant="info":

<Modal show scrollable variant="info">

Comment thread packages/styles/dialog.css
@aws-amplify-us-east-1
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2314.d15792l1n26ww3.amplifyapp.com

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses the breaking change from #2125 by making “scrollable modal” behavior opt-in via a variant="scrollable" rather than the default.

Changes:

  • Scopes scrollable dialog sizing/overflow behavior to a new .Modal--scrollable variant class.
  • Extends the React Modal API to support variant="scrollable" and updates relevant tests/screenshots accordingly.
  • Documents the new scrollable modal variant and updates the prop docs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/styles/dialog.css Scopes scrollable max-height/overflow rules to .Modal--scrollable and adjusts dialog CSS variables.
packages/react/src/components/Modal/index.tsx Adds scrollable to the variant union and applies Modal--scrollable class when selected.
packages/react/src/components/Modal/index.test.tsx Adds coverage for the new Modal--scrollable class and updates long-content a11y test to use the scrollable variant.
packages/react/src/components/Modal/screenshots.e2e.tsx Updates large-content screenshot fixtures to use variant="scrollable".
docs/pages/components/Modal.mdx Adds documentation + example for the scrollable variant and updates the variant prop description/type list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/styles/dialog.css
@Bracciata Bracciata changed the title fix: make scrollable modal a varaint rather than the default fix: make scrollable modal a separate prop rather than the default Apr 8, 2026
@Bracciata Bracciata marked this pull request as ready for review April 8, 2026 16:12
@Bracciata Bracciata requested review from a team as code owners April 8, 2026 16:12
shawnsharpDQ
shawnsharpDQ previously approved these changes Apr 8, 2026
gupta-tanvi26
gupta-tanvi26 previously approved these changes Apr 9, 2026
@Bracciata Bracciata enabled auto-merge (squash) April 10, 2026 18:22
@Bracciata Bracciata dismissed stale reviews from gupta-tanvi26 and shawnsharpDQ via 30369ab April 17, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants