From 17e0d615323eb5e2bef5730e12e7b17f8a785a9a Mon Sep 17 00:00:00 2001 From: Cee Chen <549407+cee-chen@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:38:18 -0700 Subject: [PATCH] [EuiIcon] Fix missing `style` prop on custom icons (#6888) * [EuiIcon] Fix missing `style` prop on custom icons + add `shouldRenderCustomStyles` test to ensure this doesn't regress * changelog --- src/components/icon/icon.test.tsx | 1 + src/components/icon/icon.tsx | 1 + upcoming_changelogs/6888.md | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 upcoming_changelogs/6888.md diff --git a/src/components/icon/icon.test.tsx b/src/components/icon/icon.test.tsx index abe2d46cbbb..587e803aaed 100644 --- a/src/components/icon/icon.test.tsx +++ b/src/components/icon/icon.test.tsx @@ -47,6 +47,7 @@ function testIcon(props: PropsOf) { describe('EuiIcon', () => { test('is rendered', testIcon({ type: 'search', ...requiredProps })); + shouldRenderCustomStyles(); shouldRenderCustomStyles(); describe('props', () => { diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index b920ad0c40d..aee3390cd65 100644 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -288,6 +288,7 @@ export class EuiIconClass extends PureComponent< src={icon} className={classes} css={cssStyles} + style={style} tabIndex={tabIndex} {...(rest as ImgHTMLAttributes)} /> diff --git a/upcoming_changelogs/6888.md b/upcoming_changelogs/6888.md new file mode 100644 index 00000000000..6d24f25b4ea --- /dev/null +++ b/upcoming_changelogs/6888.md @@ -0,0 +1,4 @@ +**Bug fixes** + +- Fixed `EuiIcon` not correctly passing the `style` prop custom `img` icons +