Skip to content

Commit 9c97f83

Browse files
committed
Fix issues with path overrides.
1 parent e2ce29b commit 9c97f83

41 files changed

Lines changed: 71 additions & 44 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/components/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Bug Fixes
6+
7+
- `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. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))
8+
59
## 34.0.0 (2026-05-27)
610

711
### Breaking Changes

packages/components/src/item-group/styles.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export const unstyledButton = ( as: 'a' | 'button' ) => {
1919
text-align: start;
2020
text-decoration: ${ as === 'a' ? 'none' : undefined };
2121
22-
svg,
23-
path {
22+
svg {
2423
fill: currentColor;
2524
}
2625

packages/edit-site/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Bug Fixes
6+
7+
- `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))
8+
59
## 6.47.0 (2026-05-27)
610

711
## 6.46.0 (2026-05-14)

packages/edit-site/src/components/sidebar-navigation-item/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ export default function SidebarNavigationItem( {
6363
{ ...props }
6464
>
6565
<HStack justify="flex-start">
66-
{ icon && (
67-
<Icon
68-
style={ { fill: 'currentcolor' } }
69-
icon={ icon }
70-
size={ 24 }
71-
/>
72-
) }
66+
{ icon && <Icon icon={ icon } size={ 24 } /> }
7367
<FlexBlock>{ children }</FlexBlock>
7468
{ withChevron && (
7569
<Icon

packages/icons/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Enhancements
66

77
- Redraw 34 icons as stroke-based for variable stroke-width support (per [#78774](https://github.com/WordPress/gutenberg/pull/78774)): `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`, `starEmpty`, `starFilled`, `starHalf`, `styles`, `timeToRead`, `tip`. ([#78804](https://github.com/WordPress/gutenberg/pull/78804))
8+
- 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))
89

910
## 13.2.0 (2026-05-27)
1011

packages/icons/lib/generate-library.cjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,31 @@ function svgToTsx( svgContent ) {
262262
}
263263
);
264264

265+
// Convert CSS-string style attributes (e.g. `style="fill: none"`) into JSX
266+
// style object syntax (e.g. `style={ { fill: 'none' } }`). Source SVGs use
267+
// the CSS-string form so they remain valid SVG when read by non-React
268+
// renderers (the PHP path, webpack SVG loaders, raw file preview).
269+
jsxContent = jsxContent.replace(
270+
/\sstyle="([^"]*)"/g,
271+
( _, cssString ) => {
272+
const declarations = cssString
273+
.split( ';' )
274+
.map( ( decl ) => decl.trim() )
275+
.filter( Boolean )
276+
.map( ( decl ) => {
277+
const colonIndex = decl.indexOf( ':' );
278+
const key = decl.slice( 0, colonIndex ).trim();
279+
const value = decl.slice( colonIndex + 1 ).trim();
280+
const camelKey = key.replace( /-([a-z])/g, ( _m, c ) =>
281+
c.toUpperCase()
282+
);
283+
return `${ camelKey }: '${ value }'`;
284+
} )
285+
.join( ', ' );
286+
return ` style={ { ${ declarations } } }`;
287+
}
288+
);
289+
265290
// Tags that ought to be converted to WordPress primitives when converting
266291
// SVGs to React elements
267292
const primitives = {
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)