-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5601] fix(modal): restore conditional rendering of children when closed #3189
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
🦋 Changeset detectedLatest commit: 98ad0f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
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.
Pull Request Overview
Restores conditional rendering of Modal children so they unmount when the Modal is closed (regression fix from v20, returning to v19 behavior). This reduces unnecessary DOM nodes and lifecycle work while keeping the underlying dialog element mounted for API correctness.
- Wraps modal content (children, CloseButton, portal container) in an open guard
- Updates test to assert children are not rendered when closed
- Adds a changeset documenting the patch release
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/modal/src/Modal/ModalView.tsx | Wraps all modal children in a conditional block keyed to open, ensuring they unmount when closed. |
| packages/modal/src/Modal/Modal.spec.tsx | Updates test to verify dialog remains but children are not rendered when closed. |
| .changeset/two-dogs-smash.md | Adds patch changeset describing the regression fix. |
|
Size Change: +27 B (0%) Total Size: 1.59 MB
ℹ️ View Unchanged
|
810c67d to
98ad0f9
Compare
✍️ Proposed changes
Fixes a regression introduced in Modal v20 where children remained mounted in the DOM even when the modal was closed. This change restores the v19 behavior where Modal children are conditionally rendered based on the
openprop.The fix ensures:
<dialog>element remains in the DOM (required forshowModal()andclose()methods to work correctly)openistrue🎟️ Jira ticket: LG-5601
✅ Checklist
pnpm changesetand documented my changes🧪 How to test changes
pnpm -w test packages/modalto verify Modal tests passpnpm -w test packages/confirmation-modalto verify ConfirmationModal tests passpnpm -w test packages/marketing-modalto verify MarketingModal tests pass