fix: setting class on SVG elements throws TypeError#3199
Conversation
SVG elements expose `className` as a getter-only `SVGAnimatedString`,
so directly assigning `element.className = value` throws in strict mode.
Revert to using `setAttribute("class", ...)` which works for both HTML
and SVG elements.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: dc9319a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR fixes a TypeError that occurs when setting the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SVG elements expose
classNameas a getter-onlySVGAnimatedString, so directly assigningelement.className = valuethrows in strict mode. Revert to usingsetAttribute("class", ...)which works for both HTML and SVG elements.Description
This PR fixes a regression in e6a46be whereby classNames to SVG cannot be set.
Checklist: