Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some of icons are not displaying in SPFx solution #11393

Closed
siddharth-vaghasia opened this issue Dec 6, 2019 · 10 comments
Closed

Some of icons are not displaying in SPFx solution #11393

siddharth-vaghasia opened this issue Dec 6, 2019 · 10 comments

Comments

@siddharth-vaghasia
Copy link

Some of the office UI fabric icons not displaying in SPFx webpart

Environment Information

  • Package version(s):
    "@microsoft/sp-office-ui-fabric-core": "~1.4.0",
    office-ui-fabric-react@5.21.0

  • Browser and OS versions: Chrome 78.0.3904.108 on Windows 10

Actual behavior:

Some of icons are not getting displayed when used with office ui fabric react in SPFx webpart. Below is my code.

import { Icon } from 'office-ui-fabric-react/lib/Icon';

<Icon iconName={"AccountManagement"} />
<Icon iconName={"BuildDefinition"} />
<Icon iconName={"ExternalBuild"} />

Below are some of icon name which are working fine and many others....

<Icon iconName={"BuildQueueNew"} />
<Icon iconName={"WebAppBuilderFragmentCreate"} />

I also tried to call method intializeIcons() but still same behavior.

import { initializeIcons } from '@uifabric/icons';
// Below method was called in render method of react component.
initializeIcons();

Expected behavior:

All the icons should display correctly.

Observation and Analysis

When we remove one css property from tag, missing icons are getting displayed correctly.

image

Priorities and help requested:

Are you willing to submit a PR to fix? - No

Requested priority: Normal

Products/sites affected: (if applicable)

@xugao
Copy link
Contributor

xugao commented Dec 6, 2019

@siddharth-vaghasia - if I am not mistaken, this css is added by your app, not by fabric, and this is what's breaking you:
image

If so, can we investigate in your app code why this style is being dropped?

@siddharth-vaghasia
Copy link
Author

siddharth-vaghasia commented Dec 6, 2019 via email

@xugao
Copy link
Contributor

xugao commented Dec 7, 2019

@siddharth-vaghasia - to clarify - i don't meant the font-family or any icons of your own. i meant by this entire block:

.ms-SPLegacyFabricBlock .ms-Icon { ... }

This looks like CSS from your app

@siddharth-vaghasia
Copy link
Author

@siddharth-vaghasia ...this entire block is not from my app, it is being added automatically.

@xugao
Copy link
Contributor

xugao commented Dec 7, 2019

@siddharth-vaghasia - ok i see. .ms-SPLegacyFabricBlock is not something Fabric would add. It must be from SPFx. I will need to ask around my team and get back to you.

@khmakoto
Copy link
Member

khmakoto commented Dec 9, 2019

@siddharth-vaghasia do you use the Fabric provided icons or do you provide your own icons in your SPFx solution?

@siddharth-vaghasia
Copy link
Author

@khmakoto ....I am using Fabric provided icons...

@xugao
Copy link
Contributor

xugao commented Dec 9, 2019

@siddharth-vaghasia - we will need help from SPFx to understand/resolve this issue. a related issue from SPFx side is mentioned above

@KevinTCoughlin
Copy link
Member

KevinTCoughlin commented Dec 18, 2019

This is related to a regression with Fabric React 7 and Fabric Core styles filed at #10449. It is currently unresolved.

SPFx introduced a guard for the above for existing and future solutions. See SPFx documentation for safely using Fabric core styles: https://github.com/SharePoint/sp-dev-docs/wiki/Safely-using-legacy-Fabric-Styles.

cc: @patmill @VesaJuvonen

@xugao
Copy link
Contributor

xugao commented Feb 13, 2020

resolving this issue as fixed by #11524

@xugao xugao added the Status: Fixed Fixed in some PR label Feb 13, 2020
@xugao xugao closed this as completed Feb 13, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Mar 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants