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
GivenBootstrap StylesandBootstrap Layout Builderare configured for a selected content
When an editor adds a new section
And selects aBackground Imagefor 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 aBackground Colorto it
And saves the section configurations
Then the section will show theBackground Color
But not theBackground Image
When the editor edits the same section for the third time
Then thebackground Imagewill still be present in the settings UI form element
When the editor saves only the section settings
Then theBackground Imagewill be displayed
And the last selectedBackground Colorwill 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.
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
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | Test-Section-Backgrounds--after-the-fix.png | 2.48 MB | rajab natshah |
| #12 | 3221526-12.patch | 7.21 KB | rajab natshah |
| #4 | 3221526-render-backgrounds.patch | 2.04 KB | Anonymous (not verified) |
Issue fork bootstrap_styles-3221526
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
Comment #1
Anonymous (not verified) commentedanneeasterling created an issue. See original summary.
Comment #2
Anonymous (not verified) commentedAfter 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.
Comment #3
Anonymous (not verified) commentedComment #4
Anonymous (not verified) commentedAttached 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.
Comment #5
Anonymous (not verified) commentedPlease disregard my last patch. Due to changes in the latest version, additional work is needed on the bs-video-background.html.twig template.
Comment #6
ahmad abbad commentedI'm facing the same problem where if I add the image first and then the background color, the background image disappears.
Comment #7
rajab natshahI 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.
Comment #8
rajab natshahComment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahFind 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
Comment #12
rajab natshahComment #14
rajab natshahComment #15
rajab natshahNeeds more reviews and testing before committing
Comment #16
rajab natshahComment #17
rajab natshahComment #18
ahmad abbad commentedPatch #12 works for me
Thank you Rajab
Comment #19
ahmad abbad commentedAfter 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 62Warning: Trying to access array offset on value of type null in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 61Warning: Undefined array key "background" in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 62Warning: Undefined array key "background" in Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style\BackgroundColor->buildStyleFormElements() (line 62Comment #20
ahmad abbad commentedComment #21
rajab natshahThanks, Ahmad, for testing and following up on the issue.
Our wait on committing came with good capturing of warnings and other issues
Comment #22
rajab natshahComment #24
rajab natshahComment #25
rajab natshahComment #26
rajab natshah✅ Released bootstrap_styles-1.1.2
Comment #27
rajab natshah