Skip to content

[react-dom] Support maskType SVG prop#35921

Merged
eps1lon merged 1 commit intofacebook:mainfrom
sleitor:fix/svgattr-mask-type-2
Feb 27, 2026
Merged

[react-dom] Support maskType SVG prop#35921
eps1lon merged 1 commit intofacebook:mainfrom
sleitor:fix/svgattr-mask-type-2

Conversation

@sleitor
Copy link
Contributor

@sleitor sleitor commented Feb 27, 2026

Summary

React currently does not recognize the maskType prop on SVG elements, causing:

  1. The attribute to be rendered as-is (maskType="luminance") rather than the correct mask-type="luminance"
  2. A React warning: "React does not recognize the maskType prop on a DOM element"

The SVG mask-type attribute is valid per MDN and specifies whether a mask is used as a luminance or alpha mask.

Changes

  • getAttributeAlias.js: Add ['maskType', 'mask-type'] to the SVG attribute alias map (alphabetically between markerStart and overlinePosition)
  • possibleStandardNames.js: Add masktype: 'maskType' entry so the dev-mode warning correctly suggests the camelCase spelling

Test

// Before: renders as <mask maskType="luminance"> + React warning
// After: renders as <mask mask-type="luminance"> correctly
<svg>
  <mask id="m" maskType="luminance">...</mask>
</svg>

Fixes #35920

Add maskType → mask-type to the SVG attribute alias map so React
correctly renders <mask maskType="luminance"> as mask-type="luminance"
on the DOM element instead of the unrecognized camelCase prop.

Also add the masktype → maskType entry in possibleStandardNames so the
development warning points users to the correct camelCase spelling.

Fixes: facebook#35920
MDN reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/mask-type
@meta-cla meta-cla bot added the CLA Signed label Feb 27, 2026
@eps1lon eps1lon changed the title fix: support maskType SVG attribute as mask-type [reaxct-dom] Support maskType SVG prop as mask-type Feb 27, 2026
@eps1lon eps1lon changed the title [reaxct-dom] Support maskType SVG prop as mask-type [reaxct-dom] Support maskType SVG prop Feb 27, 2026
@eps1lon eps1lon changed the title [reaxct-dom] Support maskType SVG prop [react-dom] Support maskType SVG prop Feb 27, 2026
Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@react-sizebot
Copy link

Comparing: b4a8d29...f54905d

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 611.76 kB 611.79 kB +0.02% 108.10 kB 108.12 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 677.69 kB 677.72 kB +0.01% 119.06 kB 119.08 kB
facebook-www/ReactDOM-prod.classic.js = 697.89 kB 697.92 kB +0.01% 122.63 kB 122.65 kB
facebook-www/ReactDOM-prod.modern.js = 688.21 kB 688.24 kB +0.01% 121.01 kB 121.02 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against f54905d

@eps1lon eps1lon merged commit 843d69f into facebook:main Feb 27, 2026
419 of 420 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 27, 2026
Co-authored-by: Dmitrii Troitskii <jsleitor@gmail.com>

DiffTrain build for [843d69f](843d69f)
github-actions bot pushed a commit that referenced this pull request Feb 27, 2026
Co-authored-by: Dmitrii Troitskii <jsleitor@gmail.com>

DiffTrain build for [843d69f](843d69f)
@sleitor sleitor deleted the fix/svgattr-mask-type-2 branch February 27, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: React does not recognize the maskType prop on a DOM element.

3 participants