fix(Modal): show header close button when onClose is provided#1660
fix(Modal): show header close button when onClose is provided#1660KrotovM wants to merge 1 commit intothemesberg:mainfrom
Conversation
|
@KrotovM is attempting to deploy a commit to the Bergside Team on Vercel. A member of the Team first needs to authorize it. |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe Modal component's close button visibility logic is refactored from using a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The Modal header close (X) button was only shown when
dismissible={true}, which tied the close control to backdrop/Escape behavior and broke the case where onClose is used without dismissible (see #1658).Changes:
onCloseis provided, regardless ofdismissible.onCloseis provided; no close button whenonCloseis not provided; backdrop does not close whendismissibleis true butonCloseis not provided.modal.mdxthat the header close (X) button is shown when onClose is passed.Motivation: Restore the expected behavior (close button when onClose is set), match the documented meaning of
dismissible.Related issues
Fixes #1658.
Breaking API changes
None.
No props were added or removed and the theme was not changed. This only restores and clarifies behavior:
onClosewithoutdismissible: The header close button now appears (and works) again; no code change needed.dismissible={true}andonClose: Behavior is unchanged; no code change needed.onClose: Behavior is unchanged; no code change needed.Summary by CodeRabbit
Bug Fixes
onCloseprop is provided and triggers the callback when clicked.Documentation
onCloseprop.