SOLVED: Overly broad wildcard selectors [class*="..."] in Theme Styles cause CSS leaks

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.

Screenshot 2026-02-22 at 21.13.17

Hi Bricks Team,

I’ve noticed a CSS specificity issue in Bricks 2.2 regarding how Button Theme Styles (Danger, Dark, Light, Info, etc.) are applied to elements on the frontend.

The Issue: When I create a custom class for a button that happens to contain one of the theme style keywords (for example, danger or dark), Bricks dynamically outputs an overly aggressive CSS attribute selector using the *= (substring match) wildcard.

For instance, the frontend outputs: :root .bricks-button[class*="danger"]:not(.outline) { ... }

Why this is a problem: Because *= matches any substring within the class attribute, this CSS rule will accidentally target and hijack the styling of any button whose class merely contains that string. For example, if I create custom utility classes like:

  • .no-danger-btn

  • .dark-mode-toggle

  • .highlight-darker

Bricks will falsely flag these as “Danger” or “Dark” buttons and forcefully apply the native Theme Styles, overriding my custom CSS. (A similar issue was actually reported a while back regarding [class*="light"] overriding hover states in the builder).

Hi @jorgoiliakopoulos,

Thank you for the report. I was able to replicate it and I’ve created a task for this.

Thanks,
Matej

We’ve addressed this in Bricks 2.4-beta (beta release), now available for manual download from your Bricks account.

Please read the changelog entry before testing, and let us know if you experience any issues. Note: beta builds are not recommended for production sites.