fix(vr): move data-vr attrs to ComponentPreview element#320
fix(vr): move data-vr attrs to ComponentPreview element#320mattrothenberg merged 1 commit intomainfrom
Conversation
Screenshots were capturing the entire ComponentExample (preview + code block). Move the VR attributes to just the ComponentPreview div so screenshots capture only the rendered component.
|
/bonk please review this follow up PR. |
There was a problem hiding this comment.
LGTM! Clean fix that correctly moves the data-vr-* attributes from the outer ComponentExample wrapper to the inner ComponentPreview element.
Changes look good:
ComponentExample.astro: Moves{...vrAttrs}spread from outer div to<ComponentPreview>ComponentPreview.astro: Now accepts and spreads arbitrary props via{...rest}, with properclasshandling viaclass:listfor merging
This ensures VR screenshots target only the rendered component preview (the [data-vr-demo] element) and exclude the code blocks, which should eliminate the font antialiasing false positives.
The PR description's root cause analysis is thorough and the fix is minimal and correct.
|
I've reviewed and approved PR #320. The changes are straightforward and correct:
This ensures the |
commit: |
Docs PreviewCommit: |

















































































Summary
Screenshots were capturing the entire
ComponentExample(preview + code block). This moves the VR attributes to just theComponentPreviewdiv so screenshots capture only the rendered component.Root Cause Analysis
The VR false positive saga
main, so git diff couldn't detect changed filesdata-vr-*attributes that were dropped in PR feat(docs): migrate all 38 component docs to auto-extract pattern #297's migration, and simplified the worker to use[data-vr-demo]elements directlyBut VR still showed false positives on PR #317 - 21 screenshots with "visual changes" that were actually just font antialiasing differences in the code blocks.
Why code blocks were being captured
PR #319 put the
data-vr-*attributes on the outerComponentExamplecontainer:The worker found
[data-vr-demo]and screenshotted the whole thing - preview AND code block. Code blocks have syntax highlighting with lots of small text, which accumulates font antialiasing differences across environments.The fix
Move
data-vr-*attributes toComponentPreviewonly:What changed
ComponentExample.astro: PassvrAttrstoComponentPreviewinstead of outer divComponentPreview.astro: Spread props onto the container div (withclasshandled separately for merging)Testing
After merge + worker redeploy:
Related PRs
[data-vr-demo]