Skip to content

SVG logo in the docs does not render in Firefox #3465

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

Closed
webknjaz opened this issue Jan 3, 2025 · 12 comments · Fixed by #3466
Closed

SVG logo in the docs does not render in Firefox #3465

webknjaz opened this issue Jan 3, 2025 · 12 comments · Fixed by #3466
Assignees
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. needs:discussion It's not quite clear if and how this should be done

Comments

@webknjaz
Copy link
Contributor

webknjaz commented Jan 3, 2025

Issue

$sbj. It works in Chrome, but in FF (Gentoo Linux, but I don't think this is related — it's just as broken in Firefox on Android) it renders blank. Other SVGs work for me. Like I can, see https://github.com/aio-libs/aiohttp/blob/8844385/docs/aiohttp-icon.svg. But https://github.com/tox-dev/tox/blob/e3e77a6/docs/_static/img/tox.svg is just blank everywhere — on RTD, in the GH preview and when accessing by the direct raw URL (https://tox.wiki/en/latest/_static/tox.svg). The browser gets the file and DevTools show that the nodes are being parsed.

There must be something wrong with that XML in SVG that is incompatible with FF. This needs to be investigated.

Screenshot_2025-01-03-16-16-25-83_3aea4af51f236e4932235fdada7d1643.jpg

@gaborbernat
Copy link
Member

gaborbernat commented Jan 3, 2025

Sounds to me like a firefox bug. Same on macOs.

@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

Any other SVG works, though.

@gaborbernat
Copy link
Member

That doesn't mean that it's not a firefox bug for this particular SVG.

@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

But it also doesn't mean that the SVG isn't broken either 🤷‍♂️

@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

Per https://caniuse.com/?search=svg, FF supports more SVG features than other browsers, by the way. Could it be that some other browsers are more forgiving?

@gaborbernat
Copy link
Member

It could be. I can't see anything wrong, but if someone finds a fix PR welcome. Works on Safari and Chromium based browsers.

@gaborbernat gaborbernat reopened this Jan 3, 2025
@gaborbernat gaborbernat added the needs:discussion It's not quite clear if and how this should be done label Jan 3, 2025
@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Jan 3, 2025
@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

I'll try to experiment later. Usually, playing with DevTools helps find what's wrong..

@gaborbernat
Copy link
Member

FYI: I tried re-exporting in Inkspace in various formats, but none of them seems to make FF happy.

@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

Looks like <feBlend id="feBlend2755" in2="BackgroundImage" mode="luminosity" /> is what's breaking it. Specifically, values with the word “Background” in in*= attributes break rendering: https://github.com/tox-dev/tox/blob/e3e77a6/docs/_static/img/tox.svg?short_path=462a753#L48C38-L48C48.

Removing the attribute or changing to non-background values from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/in#usage_notes makes the logo show up.

If it's not important, I suggest removing the entire filter2753 and referenced to it.

There's also a reference to an ancient BackgroundImage bug @ https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/in#workaround_for_backgroundimage. Though, the referenced discussion does not directly mention this problem.

@gaborbernat
Copy link
Member

If it's not important, I suggest removing the entire filter2753 and referenced to it.

PR welcome 👍

@webknjaz
Copy link
Contributor Author

webknjaz commented Jan 3, 2025

I've also found that the workaround posted @ svg/svgo#732 works. And it looks like they had a PR fixing this. So I assume that processing the SVG via the svgo tool should output a working SVG file.

webknjaz added a commit to webknjaz/tox that referenced this issue Jan 16, 2025
It appears that Firefox has bugs around interpreting `<feBlend>`
filters in SVG documents. This makes it render the logo as a
transparent image in the docs, both in the mobile and the desktop
versions.

This patch applies a workaround [[1]] found on the internet to make it
work without waiting for Firefox to fix their bug.

Resolves tox-dev#3465.

[1]: svg/svgo#732
@webknjaz
Copy link
Contributor Author

Here's the workaround: #3466.

@webknjaz webknjaz moved this from 🤔 Brain 🧠 dump 💡 to 🫸In review🫷 in 📅 Procrastinating in public Jan 16, 2025
@github-project-automation github-project-automation bot moved this from 🫸In review🫷 to 🌈 Done 🦄 in 📅 Procrastinating in public Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. needs:discussion It's not quite clear if and how this should be done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants