Skip to content

fix: keep pathLength on basic shapes where it is a valid attribute - #2324

Open
MFA-G wants to merge 1 commit into
svg:mainfrom
MFA-G:fix/keep-pathlength-on-basic-shapes
Open

MFA-G wants to merge 1 commit into
svg:mainfrom
MFA-G:fix/keep-pathlength-on-basic-shapes

Conversation

@MFA-G

@MFA-G MFA-G commented Nov 8, 2026

Copy link
Copy Markdown

Summary

removeUnknownsAndDefaults deleted pathLength from <circle>, <ellipse>, <line>, <polygon>, <polyline> and <rect>, so the attribute survived only on <path>.

pathLength is valid on all of the basic shapes, not just <path> — MDN lists circle, ellipse, line, path, polygon, polyline and rect. Dropping it changes rendering for stroke-dash based animations, which is what #2310 reports: an animated <circle pathLength="36"> loses the calibration and the spinner animation no longer matches its stroke-dasharray/stroke-dashoffset keyframes.

The allow-list in plugins/_collections.js simply did not list the attribute for the other shape elements.

Changes

  • Add pathLength to the attrs set of circle, ellipse, line, polygon, polyline and rect in plugins/_collections.js, matching the existing path entry.
  • Add fixture test/plugins/removeUnknownsAndDefaults.18.svg.txt covering every shape element (plus a <path> control and an unknown attribute, which is still removed).

Validation

  • pnpm test — 525 passed, 3 skipped (includes the new fixture; the plugin harness also checks idempotence over two passes)
  • pnpm lint — clean (ESLint + Prettier)
  • pnpm typecheck — clean

Before the change, <circle r="7" pathLength="36"> is emitted without pathLength under both removeUnknownsAndDefaults and preset-default; after the change it is preserved on all seven shape elements.

Closes #2310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

circle pathLength removed

1 participant