[reaxct-dom] Support maskType SVG prop#628
Conversation
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: react/react#35920 MDN reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/mask-type
Greptile SummaryAdds support for the SVG Confidence Score: 3/5
Important Files Changed
Last reviewed commit: f54905d |
| markerwidth: 'markerWidth', | ||
| mask: 'mask', | ||
| maskcontentunits: 'maskContentUnits', | ||
| masktype: 'maskType', |
There was a problem hiding this comment.
Missing hyphenated 'mask-type' entry
Every other hyphenated SVG attribute in this file includes both the lowercased form and the hyphenated form (e.g., markerstart / 'marker-start', clippath / 'clip-path', etc.). The 'mask-type': 'maskType' entry is missing here.
Without it, if a developer writes mask-type directly as a prop (the actual SVG attribute name), React won't map it to maskType and won't provide a helpful dev-mode warning suggesting the correct camelCase spelling.
| masktype: 'maskType', | |
| masktype: 'maskType', | |
| 'mask-type': 'maskType', |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-dom-bindings/src/shared/possibleStandardNames.js
Line: 317
Comment:
**Missing hyphenated `'mask-type'` entry**
Every other hyphenated SVG attribute in this file includes both the lowercased form and the hyphenated form (e.g., `markerstart` / `'marker-start'`, `clippath` / `'clip-path'`, etc.). The `'mask-type': 'maskType'` entry is missing here.
Without it, if a developer writes `mask-type` directly as a prop (the actual SVG attribute name), React won't map it to `maskType` and won't provide a helpful dev-mode warning suggesting the correct camelCase spelling.
```suggestion
masktype: 'maskType',
'mask-type': 'maskType',
```
How can I resolve this? If you propose a fix, please make it concise.maskType SVG prop
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35921
Original author: sleitor
Summary
React currently does not recognize the
maskTypeprop on SVG elements, causing:maskType="luminance") rather than the correctmask-type="luminance"maskTypeprop on a DOM element"The SVG
mask-typeattribute 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 betweenmarkerStartandoverlinePosition)possibleStandardNames.js: Addmasktype: 'maskType'entry so the dev-mode warning correctly suggests the camelCase spellingTest
Fixes #35920