diff --git a/.changeset/bright-donkeys-yawn.md b/.changeset/bright-donkeys-yawn.md new file mode 100644 index 00000000..fde91847 --- /dev/null +++ b/.changeset/bright-donkeys-yawn.md @@ -0,0 +1,7 @@ +--- +"@open-pioneer/runtime": major +--- + +Remove support for closed shadow roots. +Shadow roots used by trails applications are now always `"open"`. +See #19. diff --git a/src/packages/runtime/CustomElement.test.ts b/src/packages/runtime/CustomElement.test.ts index 6f794c26..4f667b42 100644 --- a/src/packages/runtime/CustomElement.test.ts +++ b/src/packages/runtime/CustomElement.test.ts @@ -75,17 +75,16 @@ describe("simple rendering", function () { }); }); -it("explicitly setting the shadow dom mode hides the shadow root", async () => { +it("uses mode 'open' for the internal shadow root", async () => { function TestComponent() { return createElement("span", undefined, "Hello World"); } const elem = createCustomElement({ - component: TestComponent, - openShadowRoot: false + component: TestComponent }); const { node } = await renderComponent(elem); - expect(node.shadowRoot).toBeNull(); + expect(node.shadowRoot).toBeTruthy(); }); it("allows customization of package properties", async () => { diff --git a/src/packages/runtime/CustomElement.ts b/src/packages/runtime/CustomElement.ts index e5431693..7762a8bd 100644 --- a/src/packages/runtime/CustomElement.ts +++ b/src/packages/runtime/CustomElement.ts @@ -64,12 +64,6 @@ export interface CustomElementOptions { */ resolveConfig?(ctx: ConfigContext): Promise; - /** - * Whether the shadow root element is accessible from the outside. - * Defaults to `false` in production mode and `true` during development to make testing easier. - */ - openShadowRoot?: boolean; - /** * Chakra theming object. */ @@ -161,9 +155,8 @@ export function createCustomElement(options: CustomElementOptions): ApplicationE constructor() { super(); - const mode = options.openShadowRoot ?? import.meta.env.DEV ? "open" : "closed"; this.#shadowRoot = this.attachShadow({ - mode: mode + mode: "open" }); if (import.meta.env.DEV) {