DUPLICATE: MCP: saving one element rewrites the custom CSS of every element in the post

Environment: Bricks 2.4.3 · Bricks Abilities 2.0.0 · MCP Adapter 0.7.1

This Report is formulated by Claude because claude encountered this issue.

Steps to reproduce

  1. Page with several elements whose Custom CSS contains comments and an @media block at the end.
  2. Use bricks/update-element to change one unrelated setting on a different element (e.g. _gridTemplateColumns).
  3. Open the Custom CSS of the other elements.

Expected

Only the targeted setting changes. All other CSS stays as written.

Actual

The Custom CSS of all elements in the post is rewritten:

  • Comments are removed.
  • @media / @container blocks are moved before the regular rules.
  • Grouped selectors (a, b {}) are split into separate rules.
  • Simple root declarations (#brxe-xyz { display: grid; … }) are moved into element settings.

bricks/update-global-class behaves the same for the class’s CSS. bricks/set-page-settings (page CSS) is not affected.

Why it breaks layouts

Moving @media blocks to the top changes the cascade. A base rule with the same selector now comes later and wins:

/* before */
.table tr { grid-template-columns: 1fr 6rem 16rem; }
@media (max-width: 767px) { .table tr { grid-template-columns: 1fr; } }

/* after save via MCP */
@media (max-width: 767px) { .table tr { grid-template-columns: 1fr; } }
.table tr { grid-template-columns: 1fr 6rem 16rem; }  /* always wins */

Result: responsive overrides silently stop working on elements that were never touched.

Hi Jonas,
Thanks for the detailed report. Please confirm whether “Bi-directional sync between Custom CSS and style controls” is enabled under Bricks settings. That will help distinguish this from the existing CSS sync issue. Until this is confirmed, avoid MCP saves on affected pages and classes, since the reported changes can alter responsive layouts.

Hi @timmse,
thanks for getting back!
This option is disabled.

Thanks for confirming. This matches the issue already tracked internally: WIP: Abilities API ignores "Custom CSS sync" being off and moves Custom CSS into style controls. We’ll update that thread once it’s fixed. Until then, please avoid MCP saves on affected pages and classes.