Skip to content

Added a consumer-controlled close path to the settings modal chrome - #29763

Merged
9larsons merged 1 commit into
mainfrom
slars/settings-modal-close-seam
Aug 5, 2026
Merged

9larsons merged 1 commit into
mainfrom
slars/settings-modal-close-seam

Conversation

@9larsons

@9larsons 9larsons commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Second step toward native settings routing (follows #29762).

SettingsModal (shade) and PreviewModalContent (settings) could only close through NiceModal's modal.remove() — and useModal() throws when a component mounts outside a NiceModal context. That blocks mounting settings modals as route elements, which the upcoming router swap needs.

What changed

  • Both components gain an optional onClose prop that supersedes the NiceModal close path (X button, backdrop click, footer Cancel, Escape, and the dirty-confirm flow all funnel through it).
  • Internally each is split into a base component taking a required requestClose, plus a thin NiceModal bridge that supplies modal.remove — chosen per render by the presence of onClose, so no conditional hooks.
  • PreviewModalContent threads onClose through to its inner SettingsModal.
  • The id='modal-backdrop' DOM contract (settings' Escape handler checks it) is untouched.

No consumer passes onClose yet — behavior is unchanged by construction.

Verification

  • Shade: build green, lint clean, unit 34 files / 289 tests
  • Admin: tsc -b clean, lint clean, unit 125 files / 1320 tests
  • Acceptance: 405/406 — the 1 failure is the known pre-existing load flake (layout.acceptance dirty-exit poll racing the / → /analytics home redirect; passes isolated; identical signature predates this change)

@nx-cloud

nx-cloud Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 4408ba7

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 7m 47s View ↗
nx run-many -t test:unit -p @tryghost/admin,@tr... ✅ Succeeded 4m 53s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 37s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 23s View ↗
nx run-many -t lint -p @tryghost/admin,@tryghos... ✅ Succeeded 2m 5s View ↗
nx run @tryghost/admin:build ✅ Succeeded 2m 5s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 47s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-04 20:46:20 UTC

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b4028ab6-db35-433c-aaef-d51be92b6c73

📥 Commits

Reviewing files that changed from the base of the PR and between 4408ba7 and 0735b3c.

📒 Files selected for processing (2)
  • apps/admin/src/settings/app/components/settings/preview-modal.tsx
  • apps/shade/src/components/patterns/settings-modal.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/admin/src/settings/app/components/settings/preview-modal.tsx
  • apps/shade/src/components/patterns/settings-modal.tsx

Walkthrough

SettingsModal and PreviewModal now accept optional onClose callbacks. Their content implementations use injected requestClose handlers for close actions and confirmation flows. When onClose is absent, compatibility wrappers invoke NiceModal removal.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a consumer-controlled close path to settings modal components.
Description check ✅ Passed The description directly explains the onClose changes, preserved NiceModal behavior, affected close flows, and verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slars/settings-modal-close-seam

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.56%. Comparing base (fa9366a) to head (0735b3c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #29763   +/-   ##
=======================================
  Coverage   75.55%   75.56%           
=======================================
  Files        1613     1613           
  Lines      142653   142668   +15     
  Branches    17617    17620    +3     
=======================================
+ Hits       107787   107805   +18     
+ Misses      33789    33788    -1     
+ Partials     1077     1075    -2     
Flag Coverage Δ
admin-tests 56.00% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- SettingsModal and PreviewModalContent could only close through NiceModal's modal.remove(), and useModal() throws when mounted outside a NiceModal context — which blocks mounting settings modals as route elements
- an optional onClose prop now supersedes the NiceModal close path; without it the components render through a thin NiceModal bridge exactly as before
- no consumer passes onClose yet, so behavior is unchanged
@9larsons
9larsons force-pushed the slars/settings-modal-close-seam branch from 4408ba7 to 0735b3c Compare August 4, 2026 20:35
@9larsons
9larsons merged commit c241f6f into main Aug 5, 2026
48 checks passed
@9larsons
9larsons deleted the slars/settings-modal-close-seam branch August 5, 2026 13:54
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.

1 participant