Skip to content

Commit 2c5f37d

Browse files
committed
fix icon colors not being shown/applied
1 parent f4015a7 commit 2c5f37d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/block-components/icon/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ export const Icon = props => {
202202
return
203203
}
204204

205+
// Don't use page icons for multicolor icons
206+
// because we target svg elements with the :nth-of-type() selector to apply the multicolor styles.
207+
if ( getAttribute( 'iconColorType' ) === 'multicolor' ) {
208+
return
209+
}
210+
205211
// Check if icon exists in pageIcons Map
206212
// The Map structure is: [SVG string (key), { id: iconId, count: number } (value)]
207213
if ( _icon ) {

src/plugins/page-icons/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ pageIconsWrapper?.setAttribute( 'id', 'stk-page-icons' )
2828
domReady( () => {
2929
if ( pageIconsWrapper ) {
3030
pageIconsWrapper.setAttribute( 'id', 'stk-page-icons' )
31-
pageIconsWrapper.setAttribute( 'style', 'display: none;' )
31+
// Don't use `display: none` to hide the page icons because it prevents gradients from being applied.
32+
pageIconsWrapper.setAttribute( 'style', 'position: absolute; top: 0; left: -9999px; width: 0; height: 0; visibility: hidden;' )
3233
createRoot( pageIconsWrapper ).render( <PageIcons /> )
3334
}
3435
} )

0 commit comments

Comments
 (0)