Custom code component CSS affects entire page instead of its own block

Created on 17 April 2025, 9 days ago

Overview

Custom code components can unintentionally affect the styling of the entire page. When CSS is added inside a custom code component, it currently applies globally, impacting elements outside of the intended code block. The CSS should be scoped or restricted to the specific code block where it is used to prevent affecting unrelated page elements.

Steps to Reproduce:

  1. Create a new code component (for example, myCode).
  2. Go to the CSS section of the component, add the following code, and click on ‘Add to components’:
    div {
      color: red;
    }
  3. Drag and drop the myCode component onto the canvas.
  4. Observe that the Drupal logo in the header and the ‘Powered by’ text in the footer have changed to red color.
  5. Publish the changes and notice that other elements like My account, Log out, Subject, Comment, and Text format text have also changed to red color.

Proposed resolution

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024