- I upgraded tailwindcss version from v3 to v4, and had to use "layer" feature to adjust priority of tailwind base and antd style. (The App component is wrapped with
<ConfigProvider>, <StyleProvider layer={true} />)
- Because antd icon style tag is "prepend" type (
), the position of style tag is always in the top of head element.
- In ConfigProvider component, it injects IconProvider with layer props(fixed to "antd") when StyleProvider layer={true}. https://github.com/ant-design/ant-design/blob/15bf00d4319584e2648bee9ca11768d83da5c251/components/config-provider/index.tsx#L564
- When that "antd" value is passed to IconProvider, it attach
@layer antd to anticon style, and the order of layer will be changed. The layer order setting in global.css is ignored.
The situation above occurred because I used another ConfigProvider in custom component module(ex: ConfigProvider -> StyleProvider -> IconProvider -> ConfigProvider). In the inner ConfigProvider, it doesn't get parent IconContext values. So I solved this problem by removing inner ConfigProvider and setting 'custom name' to IconProvider layer props.
However, with this antd icon "prepend" option, other situations might arise where the antd layer comes to the topmost layer, so I'm raising this as an issue.
This situation can be reproduced by setting IconProvider's layer value to 'antd'.
<IconProvider key="icon-provider" value={{ layer: 'antd' }} />
<ConfigProvider>, <StyleProvider layer={true} />)ant-design-icons/packages/icons-react/src/utils.ts
Line 174 in 306fe9f
@layer antdto anticon style, and the order of layer will be changed. The layer order setting in global.css is ignored.The situation above occurred because I used another ConfigProvider in custom component module(ex: ConfigProvider -> StyleProvider -> IconProvider -> ConfigProvider). In the inner ConfigProvider, it doesn't get parent IconContext values. So I solved this problem by removing inner ConfigProvider and setting 'custom name' to IconProvider layer props.
However, with this antd icon "prepend" option, other situations might arise where the antd layer comes to the topmost layer, so I'm raising this as an issue.
This situation can be reproduced by setting IconProvider's layer value to 'antd'.
<IconProvider key="icon-provider" value={{ layer: 'antd' }} />