XF 2.2 can't remove HTML widget with display: none;

Nicolas FR

Well-known member
Hello,
I created a HTML widget named top_home
In extra.less template i put this code
Less:
@media (max-width: 900px) {
    [data-widget-key="top_home"] {
        display: none;
    }
}
But it doesn't work, the widget is still displayed under 900px screen.
The same code with non html widgets works... :unsure:
 
Solution
It looks like the HTML widget doesn't have the data attributes on its wrapper for whatever reason.

There's a suggestion here, but honestly it feels more like a bug to me:

There's instructions for how to make the necessary change yourself here:

Note that if you're using advanced mode, you'll need to add the attributes yourself (or add a class of your own to target with CSS).
It looks like the HTML widget doesn't have the data attributes on its wrapper for whatever reason.

There's a suggestion here, but honestly it feels more like a bug to me:

There's instructions for how to make the necessary change yourself here:

Note that if you're using advanced mode, you'll need to add the attributes yourself (or add a class of your own to target with CSS).
 
Solution
Top Bottom