New install of bootstrap-7.x-3.x-dev using jsDelivr CDN providing Bootstrap 3.3.2 checked at Bootlint shows error:

E004 Line 32, Column 3: Containers (`.container` and `.container-fluid`) are not nestable

I believe the error is coming from the container class in header:

<body class="html front logged-in no-sidebars page-node page-node- page-node-1 node-type-page" >
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable">Skip to main content</a>
  </div>
    <header id="navbar" role="banner" class="navbar container navbar-default">
  <div class="container">
    <div class="navbar-header">

My workaround was to change navbar_classes_array in page.vars.php

  if (bootstrap_setting('navbar_position') !== '') {
    $variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position');
  }
  elseif(bootstrap_setting('fluid_container') === 1) {
//    $variables['navbar_classes_array'][] = 'container-fluid';
    $variables['navbar_classes_array'][] = '';
  }
  else {
//    $variables['navbar_classes_array'][] = 'container';
    $variables['navbar_classes_array'][] = '';
  }
  if (bootstrap_setting('navbar_inverse')) {
    $variables['navbar_classes_array'][] = 'navbar-inverse';
  }
  else {
    $variables['navbar_classes_array'][] = 'navbar-default';
  }
}

Comments

waverate’s picture

Issue summary: View changes
markhalliwell’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
Category: Bug report » Task
Priority: Normal » Minor
Status: Active » Postponed
Issue tags: +bootlint
Related issues: +#2260199: Add toggle for .container or .container-fluid in Grid settings

Technically speaking this isn't really a "bug", it's a bootlint error. One that has since been formed after this base theme has had numerous installs. Removing this is simply not an option as it would be a BC break that affect too many existing sites. The overrides.css file takes care of the nested container.

Would I love to become more "bootlint" compliant, sure. But this is something that, unfortunately, has to be addressed in 7.x-4.x.

burnsjeremy’s picture

I see the fix for container in overrides.less but not for container-fluid. I understand the workaround, I would still call it a bug since its a bootstrap rule though. Can I add the patch for the workaround to include .container-fluid being nested or does that need to wait?

markhalliwell’s picture

The only reason it's a "rule" is because of bootlint and because it is intended to give warnings for using Bootstrap only classes (not custom overrides like this project has done). So no, this particular issue isn't a "bug", just more (mis-)informative than anything.

I have re-opened/re-purposed #2349387-5: .container-fluid fix not in overrides.less for navbar to address the .container-fluid override bug.

mfernea’s picture

I ran into this issue too. I added a custom width for .container and another one for .navbar.container. The end result was that the .container inside .navbar.container wasn't wide enough.

  • To remove the .container class from .navbar is not really an option
  • To copy the page.tpl.php file to the subtheme and remove the inside .container can be a solution, but just for that it doesn't really worth
  • I added an extra rule for this case in our own styles

But I still see this as a problem. I can't figure out a situation where someone would need .container inside a .container. bootlint is right.The tpl file could be updated along with adding a change record for those who might rely on it.

For me this is: category = bug, priority = normal, status = active, version 7.x-3.x-dev :)

markhalliwell’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev

Changing to proper branch version for #2554199: Bootstrap 4.

markhalliwell’s picture

Version: 8.x-4.x-dev » 7.x-3.x-dev
Status: Postponed » Closed (won't fix)
Related issues: +#2652098: User menu links not shown properly on Static Fixed Top Nav bar, +#2845585: Setting fluid container creates duplicate container inside navbar

Actually, these related issues solved this specific problem in 8.x-3.x.

For 7.x-3.x, there are too many installations for this kind of BC breaking change to occur, thus I am closing this. If you're truly concerned about this, fix it in a sub-theme.