joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.73k stars 3.64k forks source link

[3.9] [4.0] Custom Fields : Render Class - possible display issues with PR #34391 #34903

Closed pepperstreet closed 3 years ago

pepperstreet commented 3 years ago

Hello, I just got into trouble with the changes in PR #34391. It totally messed up a site, where I used custom fields and their custom CSS class parameters extensively. I was really surprised about the sudden display issues after J!3.9.28 update... So, here is what happened to me and probably other users:

Possible Issue:

With PR #34391 you get two(!) class outputs: The first on the default list DD element with class "field entry", and a second output on the SPAN element and its actual field value. Before that PR, the field render class was already in the fieldS render layout!

Example

You want to style a certain field and its value/s. For instance, if you use CSS classes from your favorite framework like: well , alert , badge or something similar, you will get a doubled, nested styling. Which messes up the entire display.

I see the structural logic why the class has been added to the field layout file... but it was not really missing, because in previous Joomla versions it was already applied in the fieldS layout. IMHO, the current default class output is not optimal. I am not sure at the moment, if there is a better solution. Or if it makes sense to change the fieldS render layout as well. Actually, I liked the possibility to add a custom class to the entire field output. So, simply removing the first class output is not an option. And only one output at the value would not allow to style the entire appearance. Especially, when you have a multi-value field, you might need to style the surrounding element and all those values at once! So, you get some sort of visual grouping.

I think, this needs some further discussion and optimization.

Additional thoughts/Ideas:

You may have noticed that the fieldS render file adds a class "field-entry". Currently all fields get that same class. Wouldn't it make sense to add the unique field ID as a class? Maybe also the field Alias too? That would allow to target and style each field separately. Probably that would make the first render class output obsolete, and the newer output on the field VALUE span element makes more sense, i.e. does not destroy any existing style.

Originally posted by @pepperstreet in https://github.com/joomla/joomla-cms/issues/34391#issuecomment-886212118

AndySDH commented 3 years ago

I'm surprised this isn't getting more attention. I'll create a PR for this.

AndySDH commented 3 years ago

Please test PR #35559 @pepperstreet

alikon commented 3 years ago

close as we have a pr #35559