Skip to content

fix(widget): Alpine/Vue attributes blank the screenshot - #35

Merged
StanBarrows merged 1 commit into
mainfrom
fix/capture-invalid-attributes
Oct 22, 2026
Merged

StanBarrows merged 1 commit into
mainfrom
fix/capture-invalid-attributes

Conversation

@StanBarrows

Copy link
Copy Markdown
Contributor

On pages using Alpine (e.g. web.atrion.test) the annotation mode showed only the gray scrim and the sent screenshot was white.

Cause: modern-screenshot renders the page clone as an SVG foreignObject, which must be valid XML. Attribute names like :class, :role, x-on:click or x-bind:title are invalid XML (or use an unbound prefix), so the browser silently renders the whole image empty. On Atrion it came from the Alpine toast region's <template x-for>, whose content modern-screenshot clones.

Fix: onCloneEachNode removes non-namespaced attributes with invalid XML names from the clone. The live page is untouched; the attributes carry no styling.

Tests: new e2e test with Alpine-style attributes and template checks a pixel of a coloured block in the sent screenshot. It fails without the fix (Chromium + WebKit) and passes with it; the screenshot suite passes. Firefox could not launch in my local sandbox, so CI needs to cover it.

🤖 Generated with Claude Code

The page clone is rendered as SVG and must be valid XML. Attributes such
as Alpine's :class or x-on:click are not, and a single one made the
browser render the whole capture as an empty image (gray in annotation
mode, white when sent). Strip such attributes from the clone only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@StanBarrows
StanBarrows merged commit 225d1ab into main Oct 22, 2026
11 of 12 checks passed
@StanBarrows
StanBarrows deleted the fix/capture-invalid-attributes branch October 22, 2026 14:35
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