processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

!important making things hard to override

Open adrianbj opened this issue 4 months ago • 10 comments

Just one example, but in the new Konkat theme, InputfieldMarkup items gets this outline added and I want to override it, but the only way seems to be by ID because when it's by class: InputfieldMarkup the !important here won't let me.

https://github.com/processwire/processwire/blob/8ee607f06fd5221f500835751a1e3a94ae012918/wire/modules/AdminTheme/AdminThemeUikit/themes/default/admin.css#L5000

adrianbj avatar Aug 28 '25 21:08 adrianbj

@adrianbj I think the way you'd override it is to use the same CSS selector (or whatever CSS selector you want to use to target the element), and then set the --pw-border-color: with whatever value you need, i.e. --pw-order-color: transparent.

ryancramerdesign avatar Sep 18 '25 15:09 ryancramerdesign

@ryancramerdesign - problem with that is that I don't want all borders to be transparent. There are plenty of places where having a border makes sense, but I don't think InputfieldMarkup is one of them.

I don't think !important should ever be used at the base of a project because it will always cause issues like this.

adrianbj avatar Sep 18 '25 16:09 adrianbj

@adrianbj if you set the variable on the element itself, it changes the border only for that element.

.InputfieldMarkup {--pw-border-color: transparent}

We use !important in some places because the Konkat theme is inheriting from the previous theme, which has very specific selectors.

ocorreiododiogo avatar Oct 06 '25 11:10 ocorreiododiogo

Thanks @ocorreiododiogo - that does work, although it would still be a problem if I wanted to change something else about the outline, like the stroke width of it.

I understand why you need those !important instances, but I still think it's a bit of problem having three layers of admin theme - the original PW default theme, UiKit on top of that, and now Konkat on top of that. It's a lot of unncessary CSS being loaded and it also means issues like this.

adrianbj avatar Oct 06 '25 15:10 adrianbj

I am closing because even though the issue is still inherent in the system, I know it's not going to change at this stage.

adrianbj avatar Oct 06 '25 15:10 adrianbj

I wonder if we would be better with AdminThemeKonkat rather than another layer of overrides of AdminThemeUikit (which overrides Uikit, which has some Reno styles...).

matjazpotocnik avatar Oct 06 '25 15:10 matjazpotocnik

I wonder if we would be better with AdminThemeKonkat rather than another layer of overrides of AdminThemeUikit (which overrides Uikit, which has some Reno styles...).

I completely agree!

adrianbj avatar Oct 06 '25 15:10 adrianbj

@ocorreiododiogo - unfortunately I found an issue with that fix.

Now the Module Information section has no border because it is InputfieldMarkup. This isn't issue with the old theme which still has a border in this situation but not on InpufieldMarkup elements in the PageEdit interface. The issue is my case is that I often use InpufieldMarkup as a container for an AJAX response message and while it's still empty, it looks really strange with the border around nothing.

Image

PS - you can also see another issue there with the width of the Support Files section - happens at specific viewport widths.

adrianbj avatar Oct 09 '25 18:10 adrianbj

@ocorreiododiogo - just wanted to note that there are lots of other places in the admin that use InputfieldMarkup that now don't have a border, eg at the bottom of the Basics tab when editing a template. I don't honestly know what changed, but in the old theme, core usage of InputfieldMarkup resulted in a border, but custom usage didn't. I think we need any easy way to have this optional please.

adrianbj avatar Oct 16 '25 21:10 adrianbj

In case anyone else wants to have no borders on their InputfieldMarkup blocks added via a runtime only field, but keep them where they should be, the best way seems to be:

.InputfieldHeaderHidden {
    --pw-border-color: transparent
}

The point from my OP still stands though :)

adrianbj avatar Oct 26 '25 23:10 adrianbj