diff --git a/app/assets/javascripts/discourse/app/components/d-modal.hbs b/app/assets/javascripts/discourse/app/components/d-modal.hbs
index c98c0d928be..5c50992aca8 100644
--- a/app/assets/javascripts/discourse/app/components/d-modal.hbs
+++ b/app/assets/javascripts/discourse/app/components/d-modal.hbs
@@ -76,7 +76,7 @@
{{/if}}
-
+
{{#if (has-block "body")}}
{{yield to="body"}}
{{else}}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-modal-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-modal-test.js
index fa41c66eff9..fd84f89d2e3 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/d-modal-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/d-modal-test.js
@@ -72,4 +72,13 @@ module("Integration | Component | d-modal", function (hooks) {
closeModalCalled = false;
});
+
+ test("header and body classes", async function (assert) {
+ await render(
+ hbs``
+ );
+
+ assert.dom(".d-modal .modal-header").hasClass("my-header-class");
+ assert.dom(".d-modal .modal-body").hasClass("my-body-class");
+ });
});