# Why a web component disappears from an HTML export

Canonical: https://githtml.com/guides/shadow-dom-content-missing-export
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

A web component may place its rendered content inside a shadow tree that a simple HTML export does not preserve. Inspect whether the copy contains actual readable content or only custom-element tags. Export an intentional static representation when the component is essential, and do not assume its JavaScript definition or internal styles travel with the file.

## Identify the specific failure

A custom tag can remain in source even after its implementation is gone. Some export methods capture only light DOM, while the useful content was created inside a shadow root. Reopening the file then shows an empty shell.

## Make a narrow correction

Check the export method's treatment of shadow content and any declarative shadow markup separately. For a report, a normal section, table, or image may be the most reliable representation. Keep the component's state and data collection time explicit.

1. Inspect where the live component stores its readable content.
2. Determine whether the export preserved content, styles, and required state.
3. Replace essential component output with a checked static representation when appropriate.

````html
<section><h2>Component snapshot</h2><p>State: completed. Observed at 14:30 UTC.</p></section>
````

## Compare the component's rendered tree with the saved artifact

Suppose a custom results-card element shows a heading, a status, and a table in the live page. The exported source contains only an empty results-card tag and a data identifier. Inspect whether the visible content lives in a shadow root, in ordinary child nodes, or in another resource fetched during startup. These are different dependencies. An exporter that captures light DOM may preserve the custom tag without preserving the internal result, while a screenshot captures appearance but loses selectable text and structural relationships.

Choose a static representation according to the component's information rather than its implementation. A status card can become a short section; a comparison component can become a table with a caption; an interactive diagram may need a static figure and explanation. Capture the component's selected state and relevant data, not hidden alternate panels or editing controls. If shadow content is preserved declaratively, verify the export mechanism and its serialization settings explicitly. Do not assume that copying outer HTML or seeing the component's name guarantees its internal tree has traveled.

Styles can be another independent failure. Internal shadow styles may be absent, while document-level styles do not necessarily reach inside the component's boundary. Conversely, moving shadow content into ordinary HTML can expose it to unrelated global rules. Review the resulting headings, table cells, and identifiers in their new context. The completion check is informational: a reader should recover the same approved status, values, and qualifications from the exported copy. Matching the original card's dimensions or border radius is secondary, and an empty but neatly styled card should still be treated as a failed export.

## Verify the repaired artifact

Compare the exported component's actual information with the live version, not merely its bounding box or title.

## Sources and further reading

- [MDN: Using_shadow_DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM)

## Related guides

- [Diagnose the wrong image selected from srcset](https://githtml.com/guides/srcset-selects-wrong-report-image)
- [Fix sticky headings that cover the next paragraph](https://githtml.com/guides/sticky-heading-covers-report-text)
- [Diagnose a stylesheet request that returns HTML](https://githtml.com/guides/stylesheet-mime-type-html-response)
- [Why text inside a template element does not appear](https://githtml.com/guides/template-content-not-visible-html)

Editorial approach: https://githtml.com/guides/about
