-
Notifications
You must be signed in to change notification settings - Fork 19
use <svg> instead of <img> for icons #509
Comments
i definitely agree and would like to refer to the initial #500 issue. beyond
... or is that just a function of a library that we ended up using? |
We ended up implementing it without any libraries, and besides the fact that it was quicker to create single SVGs for the demo ;) @tripodsan and @trieloff actually both found having a folder with individual icons more sustainable/better manageable. As I suggested in #500 we could support both (auto-detect or make configurable), but I also think that we should have a discussion about pros and cons of each approach... |
Single SVG file:
Multiple SVG files:
Last week I thought that we might compile the entire icons folder into a single |
well, let me just state that from my manual experience working with icons as symbols, i have always gravitated to one file for manual management reasons. i almost agree on the http/2 comment, except that the overhead even within the svg file considering the usual svg export clutter that's actually only mildly helpful for most icons is considerable. compare for example:
... to ...
also, as most generated svgs don't have accessibility built in, i think taking an actual look at the svg code is very desirable in most cases and add for example title and description... so manually adding an icon is suggesting some discipline, and possibly even reconsider the viewBox.
i think bottom-line is, that i think that svg icons are used so frequently that they deserve a little bit of care and having a human developer look at the code at least once is probably a good idea. |
Hm. I've never seen anyone touch an SVG file directly and would assume that most SVGs we deal with have been created by Illustrator. I might be pessimistic, but it feels like we are betting against human laziness here. |
...considering that the source of this conversation started with https://theblog.adobe.com/ feel free to look at html source for the icons and you will see that they are even inlined in the html. |
Hi David. I definitely agree with that last statement. Not so sure about using svg attributes for accessibility. In general, stripping svgs from them before generating a sprite, tends to be a convention. (Usually with https://github.com/svg/svgo or similar) If the icons are decorative, titles and other information are not required for compliance with WCAG. When I think about it, from an operative perspective, it would be ideal for the authors to be able to maintain icons in a folder, as Lars suggested, but there should be an automated task to generate a new sprite when the contents of that folder change. |
i definitely understand the pre http/2 sprite generation for delivery performance, but i am not sure that this applies in an http/2 age anymore, i think that more general development paradigm issue i have with pre-processors, minification etc. and frankly all deployment tasks. i am not entirely sure how to read you accessibility comment. are you saying that having |
I have to agree with you that, in a system that guarantees shipping over http/2, there is no need for sprite generation. So, it's true that svgs can be requested on an individual basis, and that should not be an issue. |
In an effort to refocus this issue on the original question which tag to use for icons in the output, I created follow up issues based on the discussion above:
|
BREAKING CHANGE: icons are now rendered as <svg> instead of <img> tags. If icons have been used and styled before, CSS changes are required.
# [6.0.0](v5.6.4...v6.0.0) (2019-11-09) ### Features * **icons:** use <svg> instead of <img> tag ([#509](#509)) ([5e43175](5e43175)) ### BREAKING CHANGES * **icons:** icons are now rendered as <svg> instead of <img> tags. If icons have been used and styled before, CSS changes are required.
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@rofe do we really consider this a breaking change? Is any HTML change a breaking change? If yes, we should probably document this in |
@trieloff I personally think yes, because it will affect customer CSS. But I'm open to being convinced otherwise :) |
I think it makes sense. |
currently we seem to render something like:
which simply doesn't work without the id and so i would propose that we switch to the |
after looking a little bit more into this and having usecases where it is pretty useful to use the same icons also for the favicons, i think that a project should be able to support both. icons in the the easiest way to distinguish those would be to support
|
I opened a new issue for this |
We are currently using
<img>
tags to display SVG icons. This works fine, it just doesn't allow styling of the contents (e.g. changing the color of logo). We should either switch to<svg>
(breaking change) or make it configurable and keep<img>
as default.The text was updated successfully, but these errors were encountered: