Section background color not updated in the instant preview

Created on 15 August 2024, 4 months ago

Problem/Motivation

When changing background color of a section in the sidebar, the change does not reflect on the page unless the Update button is pressed.

Steps to reproduce

  1. Install latest version of Drupal 10 (currently 10.3.2).
  2. Install bootstrap_styles, bootstrap_layout_builder, and layout_builder_blocks.
  3. Create a new content type and enable Layout Builder for its default view display mode.
  4. Add Bootstrap 1 Col section and create a content block with sample text in it.
  5. Press "Configure Section ...", and on Style tab set any background color.

Expected behavior

Background color of the section get updated right after clicking any option in the Background color list.

Actual behavior

Background color of the section does not get updated when options in the Background color list are clicked, until the Update button is pressed. Also, if any background color was already selected for the section, it gets removed from the section until the Update button is pressed.

Proposed resolution

Fix logic for checking if the background type is image or video.

Current logic checks if $group_elements['background_video'] or $group_elements['background_image'] is not an empty string. This check always passes since these elements are arrays. This causes the video background to be incorrectly recognized when only the background color is set.

🐛 Bug report
Status

Needs review

Version

1.1

Component

Code

Created by

🇷🇺Russia iamweird

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024