No Code Attached Yet
avatar stavroszach
stavroszach
29 Oct 2021

Steps to reproduce the issue

Install Joomla 4
Create a new "Custom Module", select "Advanced" tab, and add a class name in the "Module Class" field.
Vew your website on the browser and check your module's classes. The class you assigned to your module is vanished.

Expected result

The user added module class should appear in the relevant element in the document DOM

Actual result

The user added module class does not appear in the relevant element in the document DOM

System information (as much as possible)

Joomla 4.0.4
PHP 8
MariaDB 10.5.8
Windows 10 (localhost)

Additional comments

The same problem after having updated a joomla 3.10.2 website into Joomla 4.0.3, and after creating a completely new website from scratch with Joomla 4.0.4 (even before installing anything else or doing any other modifications).

avatar stavroszach stavroszach - open - 29 Oct 2021
avatar joomla-cms-bot joomla-cms-bot - change - 29 Oct 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Oct 2021
avatar brianteeman
brianteeman - comment - 29 Oct 2021

what is the chrome for that module position? Does it include the code to output the module class

avatar stavroszach
stavroszach - comment - 29 Oct 2021

Not sure what your are asking.

In the case of the joomla update I used a custom position of my own custom template.
In the case of a fresh install I used one of the existying positions of the default template.
I don't think that the module position should be of conern.

I inspect the existence of the module class only through the browser inspector.

avatar brianteeman
brianteeman - comment - 29 Oct 2021

In the template you will see the code for the module position. Something like

<jdoc:include type="modules" name="top-a" style="card" />

the style is the module chrome.

You can find the default module chromes in layouts/chrome
You can find module chromes specific for the template in templates/template_name/html/layouts/chromes

The chrome controls how the module is displayed. Not all module chromes have the code to support various options such as displaying the title or even additional module classes.

The chrome can be changed just like any template override. Or you can change the style= in the template to use a different chrome or you can change the chrome in the module itself in the options.

Hope this helps

avatar stavroszach
stavroszach - comment - 29 Oct 2021

I had everything deleted. Therefore, I reinstalled again a default Joomla 4 and searched for the above you asked.
Casiopeia seems to have two chromes "card" and "noCard", but in its template positions is using either "card" or "none".

I tested almost all Cassiopeia's positions of both styles (card, none). The problem did not appear only in some positions of style "card". But in other positions of the same style did.
I am not sure whether a position's style or another factor should be faulted.

In those few cases with "no problem", I noticed that the module class is added to the DOM only if the module's title is displayed. Turning the module title to "Hide", it also hides the module's class. Therefore all cases are problematic.

I would like to be able to hide the module title without affecting the inclusion or not of the module class, and that at any template position.

avatar brianteeman
brianteeman - comment - 29 Oct 2021

I can not confirm your findings

Test 1

Module position sidebar-right with title show and module class
image
image

Result

image

Test 2

Module position sidebar-right with title hide and module class

Result

image

avatar stavroszach
stavroszach - comment - 29 Oct 2021

After your message I ran another test and with the new data found some order in the chaos.

I tend to prepend a blank space before each module class because in older joomla 3 that was required, otherwise the Joomla's default class and the user's module class were joined. Later Joomla 3 versions added the necessary separating space by themselves. Nevertheless Joomla 3 seems to be tollerant to the blank spaces in front of a module's class.

Now, Joomla 4 considers a module class to be empty if its first character is a blank space and the module's title is set to "Hide". But it shows tollerance to the blank space if the module's title is set to "Show".
It seems that we have to clear up the prepended blank spaces in all our modules before upgrading to Joomla 4.

The only point that remains fuzzy is the matter of the class disappearing when the position style is "none". This does not happen with Joomla 3.
Do we have to turn our template positions' style into type "card", or create our own module position chrome, or will there be a new Joomla update sometime that will be tollerant to this as Joomla 3 was?

avatar stavroszach
stavroszach - comment - 29 Oct 2021

Nah!
The space thing is not the one. It seems that it is only the position style="none" that is at fault.

avatar brianteeman
brianteeman - comment - 29 Oct 2021

which is what I was pointing to at the beginning

avatar Fedik Fedik - change - 29 Oct 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-10-29 14:03:13
Closed_By Fedik
avatar Fedik
Fedik - comment - 29 Oct 2021

It seems that it is only the position style="none" that is at fault.

Then it is expected

avatar Fedik Fedik - close - 29 Oct 2021

Add a Comment

Login with GitHub to post a comment