Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ exports[`BlockIcon renders a Icon 1`] = `
aria-hidden="true"
focusable="false"
height="24"
stroke="currentColor"
stroke-width="1.5"
style="fill: none;"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"
d="M3.75 16.2031L8.6 12.7L12 15L16 11L20.25 15.2517M5 20.25H19C19.6904 20.25 20.25 19.6904 20.25 19V5C20.25 4.30964 19.6904 3.75 19 3.75H5C4.30964 3.75 3.75 4.30964 3.75 5V19C3.75 19.6904 4.30964 20.25 5 20.25Z"
stroke-linejoin="round"
vector-effect="non-scaling-stroke"
/>
</svg>
</span>
Expand Down
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fixes

- `ItemGroup`: Drop the blanket `path { fill: currentColor }` rule that was overriding stroke-based icons' intended fill via inheritance bypass. Old fill-based icons remain coloured via the surrounding `svg { fill: currentColor }` rule plus normal SVG inheritance. ([#78808](https://github.com/WordPress/gutenberg/pull/78808))

## 34.0.0 (2026-05-27)

### Breaking Changes
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/item-group/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export const unstyledButton = ( as: 'a' | 'button' ) => {
text-align: start;
text-decoration: ${ as === 'a' ? 'none' : undefined };

svg,
path {
svg {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change was necessary because without it, everything gets a fill, including what is meant to just be a stroke based circle (with a hole in the middle).

I prefer to keep PRs minimal, but this one was necessary in order for this PR to be possible to land. I have some additional changes I want to push—a normalisation script and some more resilience, but this was a minimal change I was able to do. I wasn't able to find any ill consequences from this change, but CC'ing some component experts for a gut check: @mirka @ciampo

fill: currentColor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Snapshot Diff:
role="listitem"
>
<div
- class="components-item css-14dwj71-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-avymxl-PolymorphicDiv-large-item-spacedAround e19lxcc00"
- class="components-item css-fu1jn6-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-1v71yvn-PolymorphicDiv-large-item-spacedAround e19lxcc00"
data-wp-c16t="true"
data-wp-component="Item"
>
Expand All @@ -24,8 +24,8 @@ Snapshot Diff:
role="listitem"
>
<div
- class="components-item css-14dwj71-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-avymxl-PolymorphicDiv-large-item-spacedAround e19lxcc00"
- class="components-item css-fu1jn6-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-1v71yvn-PolymorphicDiv-large-item-spacedAround e19lxcc00"
data-wp-c16t="true"
data-wp-component="Item"
>
Expand All @@ -44,8 +44,8 @@ Snapshot Diff:
role="listitem"
>
<div
- class="components-item css-5pzc6i-PolymorphicDiv-medium-item e19lxcc00"
+ class="components-item css-y16wpf-PolymorphicDiv-large-item e19lxcc00"
- class="components-item css-led471-PolymorphicDiv-medium-item e19lxcc00"
+ class="components-item css-50unpk-PolymorphicDiv-large-item e19lxcc00"
data-wp-c16t="true"
data-wp-component="Item"
>
Expand Down Expand Up @@ -114,8 +114,8 @@ Snapshot Diff:
@@ -1,18 +1,18 @@
<div>
<div
- class="components-item-group css-7sdlfv-PolymorphicDiv-rounded e19lxcc00"
+ class="components-item-group css-12ds22-PolymorphicDiv-separated-rounded e19lxcc00"
- class="components-item-group css-4q29d5-PolymorphicDiv-rounded e19lxcc00"
+ class="components-item-group css-erdzxe-PolymorphicDiv-separated-rounded e19lxcc00"
data-wp-c16t="true"
data-wp-component="ItemGroup"
role="list"
Expand All @@ -125,8 +125,8 @@ Snapshot Diff:
role="listitem"
>
<div
- class="components-item css-14dwj71-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-5pzc6i-PolymorphicDiv-medium-item e19lxcc00"
- class="components-item css-fu1jn6-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-led471-PolymorphicDiv-medium-item e19lxcc00"
data-wp-c16t="true"
data-wp-component="Item"
>
Expand All @@ -142,8 +142,8 @@ Snapshot Diff:
@@ -1,18 +1,18 @@
<div>
<div
- class="components-item-group css-7sdlfv-PolymorphicDiv-rounded e19lxcc00"
+ class="components-item-group css-z3k5b4-PolymorphicDiv-bordered-rounded e19lxcc00"
- class="components-item-group css-4q29d5-PolymorphicDiv-rounded e19lxcc00"
+ class="components-item-group css-ubkzm6-PolymorphicDiv-bordered-rounded e19lxcc00"
data-wp-c16t="true"
data-wp-component="ItemGroup"
role="list"
Expand All @@ -153,8 +153,8 @@ Snapshot Diff:
role="listitem"
>
<div
- class="components-item css-14dwj71-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-5pzc6i-PolymorphicDiv-medium-item e19lxcc00"
- class="components-item css-fu1jn6-PolymorphicDiv-medium-item-spacedAround e19lxcc00"
+ class="components-item css-led471-PolymorphicDiv-medium-item e19lxcc00"
data-wp-c16t="true"
data-wp-component="Item"
>
Expand All @@ -170,7 +170,7 @@ Snapshot Diff:
@@ -1,8 +1,8 @@
<div>
<div
- class="components-item-group css-7sdlfv-PolymorphicDiv-rounded e19lxcc00"
- class="components-item-group css-4q29d5-PolymorphicDiv-rounded e19lxcc00"
+ class="components-item-group css-1ragr82-PolymorphicDiv e19lxcc00"
data-wp-c16t="true"
data-wp-component="ItemGroup"
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-site/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Bug Fixes

- `SidebarNavigationItem`: Stop forcing `style={ { fill: 'currentcolor' } }` on the icon. The explicit override was clobbering stroke-based icons' intrinsic styling. Colour is inherited via CSS `color` and the icon's own declared fills/strokes. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))

## 6.47.0 (2026-05-27)

## 6.46.0 (2026-05-14)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ export default function SidebarNavigationItem( {
{ ...props }
>
<HStack justify="flex-start">
{ icon && (
<Icon
style={ { fill: 'currentcolor' } }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This rule overrode the SVG that was inserted, and forced a fill rule on it, making it impossible to use stroke-based icons.

icon={ icon }
size={ 24 }
/>
) }
{ icon && <Icon icon={ icon } size={ 24 } /> }
<FlexBlock>{ children }</FlexBlock>
{ withChevron && (
<Icon
Expand Down
5 changes: 5 additions & 0 deletions packages/icons/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

## Unreleased

### Enhancements

- Redraw 35 icons as stroke-based for variable stroke-width support, and introduce the `vector-effect="non-scaling-stroke"` convention so stroke weight stays consistent across icon sizes (originally landed in [#78774](https://github.com/WordPress/gutenberg/pull/78774), reverted in [#78854](https://github.com/WordPress/gutenberg/pull/78854) due to CSS-override regressions, re-introduced here with the resilience fix): `addCard`, `addTemplate`, `cancelCircleFilled`, `caution`, `cautionFilled`, `code`, `commentAuthorAvatar`, `cover`, `currencyDollar`, `currencyEuro`, `currencyPound`, `drafts`, `help`, `helpFilled`, `image`, `info`, `lifesaver`, `link`, `linkOff`, `navigation`, `notAllowed`, `paragraph`, `pending`, `plusCircle`, `plusCircleFilled`, `published`, `scheduled`, `siteLogo`, `square`, `starEmpty`, `starFilled`, `starHalf`, `styles`, `time`, `tip`. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))

### Breaking Changes

- Rename `timeToRead` icon to `time`. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))
- Stroke-based icons now declare `fill` via inline `style` on the outer `<svg>` instead of the `fill` attribute, so the source's intent survives ordinary 3rd-party CSS overrides like `.foo svg { fill: currentColor }` without using `!important`. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))

## 13.2.0 (2026-05-27)

Expand Down
22 changes: 22 additions & 0 deletions packages/icons/lib/generate-library.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,28 @@ function svgToTsx( svgContent ) {
}
);

// Convert CSS-string style attributes (e.g. `style="fill: none"`) into JSX
// style object syntax (e.g. `style={ { fill: 'none' } }`). Source SVGs use
// the CSS-string form so they remain valid SVG when read by non-React
// renderers (the PHP path, webpack SVG loaders, raw file preview).
jsxContent = jsxContent.replace( /\sstyle="([^"]*)"/g, ( _, cssString ) => {
const declarations = cssString
.split( ';' )
.map( ( decl ) => decl.trim() )
.filter( Boolean )
.map( ( decl ) => {
const colonIndex = decl.indexOf( ':' );
const key = decl.slice( 0, colonIndex ).trim();
const value = decl.slice( colonIndex + 1 ).trim();
const camelKey = key.replace( /-([a-z])/g, ( _m, c ) =>
c.toUpperCase()
);
return `${ camelKey }: '${ value }'`;
} )
.join( ', ' );
return ` style={ { ${ declarations } } }`;
} );

// Tags that ought to be converted to WordPress primitives when converting
// SVGs to React elements
const primitives = {
Expand Down
4 changes: 2 additions & 2 deletions packages/icons/src/library/add-card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/library/add-template.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/icons/src/library/cancel-circle-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/icons/src/library/caution-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/library/caution.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/library/code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions packages/icons/src/library/comment-author-avatar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions packages/icons/src/library/cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/icons/src/library/currency-dollar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/icons/src/library/currency-euro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions packages/icons/src/library/currency-pound.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading