Skip to content

fix: invalid DOM property warning for custom attributes#365

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/custom-attribute-jsx-mapping
Jun 16, 2026
Merged

fix: invalid DOM property warning for custom attributes#365
tristan-mouchet merged 1 commit into
developfrom
fix/custom-attribute-jsx-mapping

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

Summary

Custom attributes set on layers (stored in layer.settings.customAttributes) were applied to React elements verbatim. Imported/migrated layers that stored attributes in lowercase HTML form (e.g. fetchpriority, crossorigin) triggered React's "Invalid DOM property" console warning and rendered as unrecognized props.

Changes

  • Route customAttributes through the shared HTML_TO_REACT_ATTRS map in both renderers (element + iframe paths), converting fetchpriorityfetchPriority, crossorigincrossOrigin, etc.
  • Export and reuse HTML_TO_REACT_ATTRS from lib/parse-head-html.ts, removing the duplicated per-renderer htmlToJsxAttrMap objects.
  • Case-insensitive lookup so any casing of stored attributes maps correctly; already-valid attrs (e.g. decoding) pass through untouched.

Test plan

  • Open the canvas on a page with an image that has a custom fetchpriority attribute — no console warning
  • Verify the published page renders the same image without warnings
  • Confirm custom attributes like crossorigin, referrerpolicy, tabindex map to their JSX equivalents
  • Confirm valid lowercase attrs (decoding, loading) still render correctly

Custom attributes stored in layer.settings.customAttributes were
applied to React elements verbatim, so imported/migrated layers with
lowercase HTML attributes (e.g. fetchpriority, crossorigin) triggered
invalid DOM property warnings. Route them through the shared
HTML_TO_REACT_ATTRS map, consolidating the previously duplicated
per-renderer attribute maps.
@tristan-mouchet tristan-mouchet added the Bug Something isn't working label Jun 16, 2026
@tristan-mouchet tristan-mouchet self-assigned this Jun 16, 2026
@tristan-mouchet tristan-mouchet merged commit c06be89 into develop Jun 16, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant