Skip to content

Conversation

Enz000
Copy link
Contributor

@Enz000 Enz000 commented Mar 27, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues Fix #2561
License MIT

The xmlns attribute was not present in the downloaded SVG icons.
To follow the W3C standard, I added it inside the svg tag.

@carsonbot carsonbot added Feature New Feature Icons Status: Needs Review Needs to be reviewed labels Mar 27, 2025
@Enz000 Enz000 marked this pull request as draft March 27, 2025 21:58
@smnandre
Copy link
Member

Problem is you now add it for everyone, everywhere, even in the inline rendering, where this is not required (and has no realy meaning).

I do believe we should try to implement custom attribute allowing/disallow list

@Kocal
Copy link
Member

Kocal commented Mar 28, 2025

Problem is you now add it for everyone, everywhere, even in the inline rendering, where this is not required (and has no really meaning).

Is it really an issue? Sure it may be not useful when inlining, but is it breaking the document or the browser?

Popular icons "libraries" like HeroIcons or FontAwesome or Google's Icons provides SVG icons with a xmlns attribute, and no one tells you to remove it if you want to inline the svg in your document.

Let's be pragmatic, always adding this xmlns attribute is fine

@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Needs Review Needs to be reviewed labels Mar 28, 2025
@norkunas
Copy link
Contributor

Let's be pragmatic, always adding this xmlns attribute is fine

which will break many tests for us

@Kocal
Copy link
Member

Kocal commented Mar 28, 2025

Let's be pragmatic, always adding this xmlns attribute is fine

which will break many tests for us

Even if the rendered HTML changes, as long as it doesn't break rendering in the browser, that's totally fine.

We understand your tests will break, but we do not really cares here, it's not like we are removing some HTML attributes or whatever more impactful.

Also, note that we already did this kind of "breaking changes" on ComponentAttributes rendering because of performance issues, and we already stated that these kind of changes were fine.

Thanks for your comprehension!

@norkunas
Copy link
Contributor

Sorry,but this will expand html size for no reason for us ... Im not against it, but at least config option would be ok

@Enz000
Copy link
Contributor Author

Enz000 commented Mar 28, 2025

Sorry,but this will expand html size for no reason for us ... Im not against it, but at least config option would be ok

The HTML size is not a valid reason for me. The attribute’s length is about 44 characters...

@norkunas
Copy link
Contributor

and when you rendering 100 icons in same page it becomes 440 :)

@Kocal
Copy link
Member

Kocal commented Mar 28, 2025

I'm pretty sure you webserver can compress your HTML response...

@Enz000
Copy link
Contributor Author

Enz000 commented Mar 28, 2025

and when you rendering 100 icons in same page it becomes 440 :)

True, but 440 characters represents almost 0,43 ko !
Still nothing but maybe I'm mistaken

@norkunas
Copy link
Contributor

i still stand with @smnandre . do as you wish, i will write a script to clean the files

@norkunas
Copy link
Contributor

I'm pretty sure you webserver can compress your HTML response...

but the repository size also grows

@Kocal Kocal changed the title [Icons] add xmnls attribute to svg icons [Icons] Add xmlns attribute to svg icons Mar 28, 2025
@Kocal
Copy link
Member

Kocal commented Mar 28, 2025

Please let's keep the discussion pertinent, I don't think the arguments "my tests will break" nor the "HTML or repo size will grow" are resonable enough to prevent this feature to ship. Otherwise, shouldn't we stop developing things and remove code only? 😬

To move forwards @Enz000, you still need to update Icons tests and we will be fine. Maybe add one or two lines in the change log about the "breaking" thing.

Thanks everyone!

@norkunas
Copy link
Contributor

As I said I'm not against it, just do not understand why such a rare need is pushed without opt-in for all users

@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Mar 28, 2025
@Enz000 Enz000 marked this pull request as ready for review March 28, 2025 23:06
@smnandre
Copy link
Member

I'm sure we can all be a bit more chill here (and respectful).

I think all points are valid here:

UX Icons was made to render SVG icons in Twig. So I do agree this use case does not feel a valid reason to change the HTML generated by everyone else.

On the other side, not having this attribute can be a real pain (at least during development) raising a valid DX problem here. And making it hard to use the icons for anything else than inline rendering. So I do agree this use case does represent a valid reason to change something.

Ideally, this situation would have require just a tiny bit of goodwill, some people giving a bit of energy or time (like really not much here) to implement something more clever/adapted.

I already mentioned on another issue (quesstion from Javier i think) the following idea: we could add a include/exclude system of attributes, globally and/or by set and/or by usage (in file / at render time), as this seems to be very opiniated debates.

So to me forcing this attribute for everyone and storing it in cache is not the best idea, clearly. I suppose this would maybe be something to be done in the commands, via an Input Option.

But I don't want either to "penalize" someone that took some time to explain its problem, open a PR to try something, etc.

Have a good week-end you guys

@Enz000 Enz000 requested a review from Kocal March 31, 2025 19:32
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Apr 1, 2025
Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Reviewed Has been reviewed by a maintainer labels Apr 2, 2025
@norkunas
Copy link
Contributor

norkunas commented Apr 2, 2025

If I will set ux_icon.default_icon_attributes.xmlns config option to false will it avoid rendering it at least? If no - would it be possible to make this work?

@smnandre
Copy link
Member

smnandre commented Apr 2, 2025

I'd like we don't make a custom option per attribute, and use something more generic / once for all if possible.

But a temporary hard-coded option would be acceptable here, until someone has time to make clean things.

Discussion / implementation ideas here: #2353

@norkunas
Copy link
Contributor

norkunas commented Apr 2, 2025

@smnandre I didn't said about custom option, I am exploring from what's available: default_icon_attributes

@kbond
Copy link
Member

kbond commented Apr 4, 2025

If I will set ux_icon.default_icon_attributes.xmlns config option to false

I like this. If it doesn't work already, we should make it work.

@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Apr 4, 2025
@Enz000 Enz000 requested a review from Kocal April 4, 2025 17:22
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Apr 4, 2025
@Kocal Kocal force-pushed the feat/add_xmlns_attribute branch from 22cc585 to 2ce9f41 Compare April 4, 2025 17:30
@Kocal
Copy link
Member

Kocal commented Apr 4, 2025

Thanks @Enz000.

@Kocal Kocal merged commit 03c2f59 into symfony:2.x Apr 4, 2025
77 of 79 checks passed
@Enz000 Enz000 deleted the feat/add_xmlns_attribute branch April 5, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Icons Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Icons] Icons are missing xmlns attribute
7 participants