question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

missing icons render a tall, skinny svg element

See original GitHub issue
screen shot 2018-02-20 at 4 59 45 pm

I believe this is because the svg has no viewbox? The other icons have a viewbox="0 0 512 512". Ideally a missing icon wouldn’t disrupt the flow of the page like this.

Edit: actually it’s the .svg-inline--fa class where a 1em height comes from. So maybe a missing SVG should have some kind of default classes?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mlwilkersoncommented, Feb 21, 2018

Yes, @jrjohnson when using the autoReplaceSvg functionality, where you place <i> tags and let our code pick those up and translate them into <svg>s, missing icons look fancy, like this: https://jsfiddle.net/mwilkerson/hpw53Lzb/2/

So there’s precedent there for showing that missing icon.

That was my initial suggestion above to @bgentry, to show the same “missing icon” icon. The alternative would be to leave it blank in the page and just log a message to the console.

I don’t have a really strong preference here myself, and I could see good reason to go either way.

But we definitely don’t want the current behavior. So I’ll put in a fix for that. For now, I’ll leave it blank and log to the console.

1reaction
mlwilkersoncommented, Feb 21, 2018

No, that wasn’t quite what I was suggesting above, however, that’s pretty close to what I had intended to be the current behavior. Currently, it logs to the console and puts out an empty SVG. The bug, as you’ve noted, is that the empty SVG messes up the flow.

So I can just make it so that the page flow is not disrupted and keep the logging as-is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG symbol a Good Choice for Icons - CSS-Tricks
The container around a little beaker icon might be tall and narrow. The container around a little fish perhaps short and long.
Read more >
How can I make an svg scale with its parent container?
This works for me. I first create a viewBox attribute on the SVG element and set the value to "0 0 [original svg...
Read more >
SVG Tutorial: How to Code SVG Icons by Hand
Follow along with the examples in this in-depth guide to learn how to draw SVG icons and simple shapes by hand.
Read more >
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
This article describes how scaling of SVG images is handled when using these ... This image specifies a width of 100 pixels but...
Read more >
Which SVG technique performs best for way too many icons?
A typical inline SVG icon takes a fraction of a millisecond to render: ... or composing too many elements in a long scroll...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found