Main Content div attributes are not set properly, breaking layout on any page with sidebar.

Created on 23 March 2018, over 7 years ago
Updated 9 July 2025, 23 days ago

In line 115 of bootstrap_barrio.theme, these lines appear:

//$width = _bootstrap_barrio_content_width(!empty($variables['page']['sidebar_first']), !empty($variables['page']['sidebar_second']));
//$content_width = 'col-md-' . $width;
$content_width = 'col';

The uncommented out line simply adds the class 'col' to the main content div. It never actually figures out if any sidebars exist, and what they are set to. That is actually done in the two commented out lines, tho at first glance it doesn't look like it accounts for every edge case. Adding just the class 'col' basically causes any layout with a sidebar to break.

It should be properly checking what sidebars exist, and what width they are set to (let alone what sizing it uses - sm, md, or lg).

πŸ’¬ Support request
Status

Closed: works as designed

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States spcbeck

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    Using Drupal 10.5.1 and Barrio 5.5.20 and having a slick image slider on the page, #8 fixed this issue.

    Thanks.

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    I didn't really have this issue as I thought. What I thought was a fix by #8 was because I was viewing the page as admin. After a few days I viewed as anonymous and the issue was there. It took me days of headaches and bewilderment to find that I had added this in a node template override,

    {% if 'administrator' in user.getroles or 'manager' in user.getroles %}
      &nbsp;/&nbsp;<div class="property-views" title="Views"><i class="fas fa-eye" title="Page views"></i>&nbsp;{{ property_listing_views }}{% endif %}</div>

    I neglected to format the code properly and also couldn't tell the closing div tag was outside the if condition block. So this closing div wasn't opened for anonymous users and it abruptly closed <div class="row row-offcanvas row-offcanvas-left clearfix"> tag leaving the sidebar outside of the grid. So for admins the page displayed properly and for anonymous the page broke.

    After days of trauma, I was able to track this down and the issue was gone. So sorry, this issue is no more existent, at least in my own experience.

  • πŸ‡³πŸ‡¬Nigeria chike Nigeria

    I discovered that even though my trailing </div> tag messed up the grid and the code at #8 was not working for anonymous users, that being my own error. Today I took off #8 from the live site and the issue came back! I looked at the markup and found,

        <div class="row row-offcanvas row-offcanvas-left clearfix flex">
          <main class="main-content col" id="content" role="main"></main>
          <div class="sidebar_second sidebar col-md-3 order-last" id="sidebar_second"></div>
          ::after
        </div>

    I put back #8 and the issue solved again. I looked at the markup again and found,

            <div class="row row-offcanvas row-offcanvas-left clearfix flex">
              <main class="main-content col col-md-9" id="content" role="main">
                <section class="section"></section>
              </main>
              <div class="sidebar_second sidebar col-md-3 order-last" id="sidebar_second"></div>
              ::after
            </div>
            ::after
          </div>

    So yes, this issue is still live and #8 solved it for me.

Production build 0.71.5 2024