Skip to content

Remove unnecessary clipPath from Sun icon SVG#56614

Merged
ryanclark merged 4 commits intomasterfrom
ryan/fix-sun-icon
Jul 9, 2025
Merged

Remove unnecessary clipPath from Sun icon SVG#56614
ryanclark merged 4 commits intomasterfrom
ryan/fix-sun-icon

Conversation

@ryanclark
Copy link
Copy Markdown
Member

@ryanclark ryanclark commented Jul 9, 2025

The sun icon copies from Figma with a clipPath that isn't necessary for the rendering of the SVG. For some reason, running this through SVGO results in an empty path being created, which blocks out the icon (<path d="M0 0h24v24H0z" />)

image

The moon icon is fine:

image

There are two more icons like this, Camera and ModelContextProtocol. I updated those too, and added info to the icon's README.md about this process (will post on Slack)

changelog: Fix some icons displaying as white/black blocks

@ryanclark ryanclark force-pushed the ryan/fix-sun-icon branch from 1b80a8f to b616bd2 Compare July 9, 2025 14:45
Comment thread web/packages/design/src/Icon/README.md Outdated
Comment on lines +13 to +15
3. Ensure that the icon does not contain unnecessary `clipPath` elements (this will be a single 24x24 rect in a
`clipPath` element). If it does, delete the `g` element (keeping the `path`) that references the `clipPath`, and the
`defs` element that contains the `clipPath`. This is necessary to ensure that the icon optimizes correctly.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could as well link to this PR for an example I think.

Comment thread web/packages/design/src/Icon/README.md Outdated
Comment on lines +13 to +15
3. Ensure that the icon does not contain unnecessary `clipPath` elements (this will be a single 24x24 rect in a
`clipPath` element). If it does, delete the `g` element (keeping the `path`) that references the `clipPath`, and the
`defs` element that contains the `clipPath`. This is necessary to ensure that the icon optimizes correctly.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Too bad we can't enforce that with a linter, there's react/forbid-elements which could forbid clipPath, but it won't work on the SVGs inside the assets folder since those are just plain SVG files and not React components.

But if someone adds a new icon that has clipPath, the icon won't be visible anyway which hopefully will be enough to catch this. 🤔

@ryanclark ryanclark enabled auto-merge July 9, 2025 15:17
@ryanclark ryanclark added this pull request to the merge queue Jul 9, 2025
Merged via the queue into master with commit 96d403e Jul 9, 2025
40 checks passed
@ryanclark ryanclark deleted the ryan/fix-sun-icon branch July 9, 2025 15:38
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@ryanclark See the table below for backport results.

Branch Result
branch/v17 Failed
branch/v18 Failed

marcoandredinis pushed a commit that referenced this pull request Jul 10, 2025
* Remove unnecessary clipPath from Sun icon SVG

* Fix other icons that use a clipPath too

* Add instructions for not including clipPaths in icons

* Link icon README to this PR
greedy52 pushed a commit that referenced this pull request Aug 26, 2025
* Remove unnecessary clipPath from Sun icon SVG

* Fix other icons that use a clipPath too

* Add instructions for not including clipPaths in icons

* Link icon README to this PR
github-merge-queue bot pushed a commit that referenced this pull request Aug 26, 2025
* Remove unnecessary clipPath from Sun icon SVG

* Fix other icons that use a clipPath too

* Add instructions for not including clipPaths in icons

* Link icon README to this PR

Co-authored-by: Ryan Clark <ryan.clark@goteleport.com>
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.

4 participants