diff --git a/packages/odyssey-react-mui/src/ui-shell/renderUiShell.tsx b/packages/odyssey-react-mui/src/ui-shell/renderUiShell.tsx
index 2bc8e9e74..72a997278 100644
--- a/packages/odyssey-react-mui/src/ui-shell/renderUiShell.tsx
+++ b/packages/odyssey-react-mui/src/ui-shell/renderUiShell.tsx
@@ -95,7 +95,6 @@ export const renderUiShell = ({
}
appRootElement={shadowDomElements.appRootElement}
- emotionRootElement={shadowDomElements.emotionRootElement}
onError={onError}
onSubscriptionCreated={publishSubscriptionCreated}
optionalComponents={Object.fromEntries(
@@ -106,6 +105,7 @@ export const renderUiShell = ({
],
),
)}
+ stylesRootElement={shadowDomElements.stylesRootElement}
subscribeToPropChanges={subscribeToPropChanges}
/>
diff --git a/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.test.tsx b/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.test.tsx
index c160c6ffa..23b612c33 100644
--- a/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.test.tsx
+++ b/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.test.tsx
@@ -13,11 +13,39 @@
import { waitFor } from "@testing-library/dom";
import {
- ReactInWebComponentElement,
+ createReactRootElements,
reactWebComponentElementName,
renderReactInWebComponent,
+ type ReactInWebComponentElement,
} from "./renderReactInWebComponent";
+describe("createReactRootElements", () => {
+ test("returns two elements at attach to a Shadow DOM", () => {
+ const { appRootElement, stylesRootElement } = createReactRootElements();
+
+ expect(appRootElement).toBeInstanceOf(HTMLDivElement);
+ expect(stylesRootElement).toBeInstanceOf(HTMLDivElement);
+ });
+
+ test("App root element has the correct attributes", () => {
+ const { appRootElement } = createReactRootElements();
+
+ expect(appRootElement).toHaveAttribute("id", "app-root");
+ expect(appRootElement).toHaveAttribute("style", "height: inherit;");
+ });
+
+ test("Emotion root element has the correct attributes", () => {
+ const nonce = "hello-world";
+
+ window.cspNonce = nonce;
+
+ const { stylesRootElement } = createReactRootElements();
+
+ expect(stylesRootElement).toHaveAttribute("id", "style-root");
+ expect(stylesRootElement).toHaveAttribute("nonce", nonce);
+ });
+});
+
describe("renderReactInWebComponent", () => {
afterEach(() => {
// Remove any appended elements
diff --git a/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.ts b/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.ts
index d699ca9bc..a57532b73 100644
--- a/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.ts
+++ b/packages/odyssey-react-mui/src/web-component/renderReactInWebComponent.ts
@@ -13,27 +13,57 @@
import { type ReactNode } from "react";
import { createRoot, type Root } from "react-dom/client";
-import {
- createUnattachedShadowDomElements,
- type ShadowDomElements,
-} from "./shadow-dom";
+/**
+ * Creates elements for a Shadow DOM that Odyssey will render into.
+ * The Emotion root is for `