Browser: Chrome
OS: macOS
URL: https://stg-sfddcprod-sfddcdev.kinsta.cloud/
HT Access
User: sfddcdev
Pass: p5sWNcKugcSp5a
I have a Button component with two variants: base and white. The white variant simply sets color to white. You can check the button in the black backgrounded section beneath the text ad by inspecting the inline CSS selector.
When I use the white variant on a template where no base variant button exists on the same page, the style does not apply.
Root cause identified via DevTools:
Bricks generates the variant CSS as:
[data-brx-variant="aorbaj"] .brxe-dhvyxd { color: var(--color-white); }
This descendant selector requires an ancestor element with data-brx-variant="aorbaj" to exist in the DOM. When only the variant is used (without the base variant on the same page), that ancestor is never rendered, so the selector never matches and the style is not applied.
Expected behavior: The variant CSS should target the element directly, e.g. .brxe-dhvyxd[data-brx-variant="aorbaj"], so it works regardless of whether the base variant is present on the page.
Steps to reproduce:
-
Create a Button component with a
baseand awhitevariant -
Use only the
whitevariant on a template (nobasevariant on the same page) -
The white color is not applied
