title: Using flex-grow:1 push the div outside of the parent container when using with bootstrap collapse
body: <p>I am creating an accordion using bootstrap 3. What I want is the accordion's height is always fixed no matter how its content is. If the content of an element is too large then a vertical scrollbar should appear inside that element. Also, when user click an element's header that element should take the rest of the height of the wrapper (and display scrollbar if the rest of height is not enough).</p>
  
  <p>I change flex-grow:1 when user click on the panel-header. However, when clicking "Collection 2" the scrollbar didnt appear inside the content-body of "Collection 2" as I expected and the accordion is pushed outside of the wrapper div. Could you please help? I prefer a css only solution if possible. Thanks.</p>
  
  <p>The template is:</p>
  
  <pre><code> &lt;body ng-app="accordion" ng-controller="ctrler as ctrl"&gt;
      &lt;div id="wrapper" class="full-height wrapper"&gt;
         &lt;div class="panel-border panel-group column-flex full-height" id="accordion"&gt;
           &lt;div ng-repeat='key in [1,2,3]' class='panel panel-default'&gt;
              &lt;div class="list-group-item"&gt;
                 &lt;a class="panel-title" data-toggle="collapse" data-target="#{{key}}" data-parent="#accordion" ng-click='onClick($event)'&gt;Collection {{key}}&lt;/a&gt;
              &lt;/div&gt;
              &lt;div class="panel-collapse collapse content-body" id="{{key}}"&gt;
                &lt;div class="panel-body"&gt;
                  &lt;ul class="list-unstyled"&gt;
                    &lt;li ng-repeat="item in data1"&gt;
                      &lt;div&gt;{{item}}&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
           &lt;/div&gt;
         &lt;/div&gt;
      &lt;/div&gt;
   &lt;/body&gt;
  </code></pre>
  
  <p>The styling is :</p>
  
  <pre><code>  .column-flex{
      display : flex;
      flex-direction: column;
    }
  
   .wrapper {
     height: 500px;
     border-style: solid;
   }
  </code></pre>
  
  <p>The code to add flex-grow is: </p>
  
  <pre><code>      if($(e.target).parents('.panel').css('flex-grow')==1){
              $element.find(".panel").css('flex-grow',0);
        }else{
              $element.find(".panel").css('flex-grow',0);
              $(e.target).parents('.panel').css('flex-grow',1);
        }
  </code></pre>
  
  <p>You can check the example here : <a href="https://plnkr.co/edit/iqrHG80GXj8teiRGeBU8?p=preview" rel="nofollow noreferrer">https://plnkr.co/edit/iqrHG80GXj8teiRGeBU8?p=preview</a>. </p>