Problem/Motivation

When using a background image on a section, background color and background image settings are ignored. Because users may not be able to display the video (say, on mobile devices), the background image and color should also be rendered. This is a major UX issue for accessibility and responsiveness and must be resolved.

Steps to reproduce

Create a section. In Style > Background settings, select a color, add an image and a background video. Save.
Expect all three to be rendered, but only the background video is.

Scenario: Configuring Background Image and Color in a Section
Given Bootstrap Styles and Bootstrap Layout Builder are configured for a selected content
When an editor adds a new section
And selects a Background Image for the section
And saves the section configurations
Then the section will display the selected background image
When the editor edits the same section for the second time
And adds a Background Color to it
And saves the section configurations
Then the section will show the Background Color
But not the Background Image
When the editor edits the same section for the third time
Then the background Image will still be present in the settings UI form element
When the editor saves only the section settings
Then the Background Image will be displayed
And the last selected Background Color will not be displayed

Proposed resolution

Render everything that is set under Style > Background. I'm currently studying the module to determine why it functions differently from v1. I expect that it's due to the separation of the templates that is implemented in Bootstrap Styles module, but not sure. If this is more appropriate in that module's issue queue, please feel free to move it.

The UI/UX behavior should match the chosen values. Have the status which following the settings UI selection. When all three options are set, they should all appear on the section on top of each other.

If the section settings form includes a Background Color, it should show on the page.
If a Background Image or Background Video in the section settings form was selected, it should render on the page.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ✅ Readability
  • ✅ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ✅ Code review by maintainers
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release notes snippet
  • ✅ Release bootstrap_styles-1.1.2

User interface changes

None. In fact, the module should function as the UI implies -- that setting all three will result in all three being rendered.

Bootstrap Styles - Test Section Backgrounds after the fix

API changes

  • N/A

Data model changes

Probably none, but unknown.

Section config should serialized data, and should match with the interface
On loading of old saved default config
When changed from the UI and saved, section config should change.
The build or render of the section should match too

Release notes snippet

  • Issue #3221526: Fixed rendering both Background Color and Background Image or Video
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anonymous’s picture

anneeasterling created an issue. See original summary.

Anonymous’s picture

Project: Bootstrap Layout Builder » Bootstrap Styles
Version: 2.0.1 » 1.0.x-dev

After digging through the modules, this seems to be a question for Bootstrap Styles, rather than Bootstrap Layout Builder, where I originally posted it.

I'm now attempting to determine why sections with video backgrounds are handled differently and see if I can get the attributes from sections without background videos to be recognized on the bs-video-background.html.twig template.

Anonymous’s picture

Version: 1.0.x-dev » 1.0.3
Anonymous’s picture

StatusFileSize
new2.04 KB

Attached is a patch that allows rendering of all three possible settings -- background color, image and video. Basically, conditions are removed allowing each to be rendered as needed to meet accessibility needs.

Anonymous’s picture

Please disregard my last patch. Due to changes in the latest version, additional work is needed on the bs-video-background.html.twig template.

ahmad abbad’s picture

I'm facing the same problem where if I add the image first and then the background color, the background image disappears.

rajab natshah’s picture

Assigned: Unassigned » rajab natshah
Issue summary: View changes

I confirm the issue!

The UI/UX behavior should match the chosen values. Have the status which following the settings UI selection. When all three options are set, they should all appear on the section on top of each other.

If the section settings form includes a Background Color, it should show on the page.
If a Background Image or Background Video in the section settings form was selected, it should render on the page.

Steps to reproduce

Scenario: Configuring Background Image and Color in a Section
Given Bootstrap Styles and Bootstrap Layout Builder are configured for a selected content
When an editor adds a new section
And selects a Background Image for the section
And saves the section configurations
Then the section will display the selected background image
When the editor edits the same section for the second time
And adds a Background Color to it
And saves the section configurations
Then the section will show the Background Color
But not the Background Image
When the editor edits the same section for the third time
Then the background Image will still be present in the settings UI form element
When the editor saves only the section settings
Then the Background Image will be displayed
And the last selected Background Color will not be displayed

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Title: Render background color and image when also using background video » Fix rendering both Background Color and Background Image or Video
Issue summary: View changes
StatusFileSize
new1.8 MB
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Find out that the Background type is a filed type of radios
When editors click on the color, image, video tab option, they are selecting a radios form element value.
Which will be saved

rajab natshah’s picture

StatusFileSize
new7.21 KB

rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Issue summary: View changes
Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes
StatusFileSize
new2.48 MB

Needs more reviews and testing before committing

  • ➖ Testing to ensure no regression
  • ➖ Full testing and approval
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Version: 1.0.3 » 1.1.1
ahmad abbad’s picture

Patch #12 works for me
Thank you Rajab

ahmad abbad’s picture

After further testing and applying the patch to projects
I faced the following warnings

Warning: Trying to access array offset on value of type null in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 62
Warning: Trying to access array offset on value of type null in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 61
Warning: Undefined array key "background" in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 62
Warning: Undefined array key "background" in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 62

ahmad abbad’s picture

Status: Needs review » Needs work
rajab natshah’s picture

Thanks, Ahmad, for testing and following up on the issue.

Our wait on committing came with good capturing of warnings and other issues

rajab natshah’s picture

Assigned: Unassigned » rajab natshah
Status: Needs work » Active

  • Rajab Natshah committed 548ddb5a on 1.0.x
    Issue #3221526: Fix rendering both Background Color and Background Image...
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Issue summary: View changes
Status: Active » Needs review
Issue tags: +bootstrap_styles-1.1.2
rajab natshah’s picture

Status: Needs review » Fixed
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.