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

showMissingIcons = false does not hide the missing icon indicator when icon name is missing #12581

Open
4 of 7 tasks
robmadole opened this issue Mar 12, 2018 · 7 comments
Open
4 of 7 tasks
Assignees
Labels

Comments

@robmadole
Copy link
Member

Describe the problem

Changing this setting:

<script>FontAwesomeConfig = { showMissingIcons: false}</script>

Still shows the missing icon indicator.

What did you expect?

Setting showMissingIcons to false should hide any missing icon indicator.

What version and implementation are you using?

Version: 5.0.8
Browser and version: all

  • SVG with JS
  • Web Fonts with CSS
  • SVG Sprites
  • On the Desktop

Reproducible test case

https://codepen.io/robmadole/pen/EEVxBX

Bug report checklist

  • I have filled out as much of the above information as I can
  • I have included a test case because my odds go way up that the team can fix this when I do
  • I have searched for existing issues and to the best of my knowledge this is not a duplicate
@mlwilkerson
Copy link
Member

mlwilkerson commented Mar 14, 2018

I've tracked this down. It's due to this check in dom.js in findIcon():

} else if (iconName && prefix && !config.showMissingIcons) {

In your repro, iconName is null, which makes sense, because you've given it only class fas fa-fw. And fw is in our RESERVED_CLASSES list, so isReserved() returns true and thus getIconName() returns null in the class parser.

@mlwilkerson
Copy link
Member

So this seems to be a special case where a reserved class is used without another icon name. What should the behavior be?

@robmadole
Copy link
Member Author

Ah, ok. That makes sense. I think we can come back to this once 5.1 is out @mlwilkerson. This is not high enough in priority to tackle it right this moment.

@robmadole robmadole changed the title showMissingIcons = false does not hide the missing icon indicator showMissingIcons = false does not hide the missing icon indicator when icon name is missing Mar 14, 2018
@mlwilkerson
Copy link
Member

OK, when the time comes to fix it, we have a regression test ready to enable here:
integrations/regressions/issue-12581

@markmaruska
Copy link

+1

@mlwilkerson
Copy link
Member

Also, there is a use case for doing <i class="fa fa-fw"></i> that reportedly worked in version 4, and demonstrably still works in v5, when using Webfonts with CSS. See this codepen for a demo. So this could be considered a regression from v4, the fact that v5 SVG with JS doesn't work.

@kevinwhoffman
Copy link

I'm developing with FA5 in a WordPress plugin, so it's important that I am able to target which elements I am affecting through my plugin in case other plugins are still using FA4.

Here is the config I'm using:

import fontawesome from '@fortawesome/fontawesome';

fontawesome.config = {
	familyPrefix: 'myprefix',
	showMissingIcons: false
};

Here is an example of two elements that are both being affected by FA5 as configured above.

<i class="fas myprefix-camera"></i> // My FA5 icon working as expected.
<i class="fa fa-camera"></i> // Another plugin's FA4 icon that is replaced with the animated missing icon. This should not happen.

I believe this bug is the reason why the fa fa-camera element is being replaced. I just wanted to confirm it and share why it's important within a WordPress context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants