title: Bootstrap 4 custom list-group collapse caret functioning incorrectly
body: <p>I have customized a Bootstrap 4 list-group, to include the collapse functionality.</p>
  
  <p>I have included a css caret arrow, so the use case should be:
  1. initial state is pointing down
  2. when clicked points up
  3. clicked again points back down to its initial state</p>
  
  <p>My issue is is that on the initial click the caret does not do anything, only when it is clicked a second time it will point up.</p>
  
  <p>I am using the css transform selectors to rotate the caret up/down.</p>
  
  <p>Why does this not work properly, am I missing something/doing something incorrectly?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.btn {
    box-shadow: none !important;
    outline: 0;
  }
  
  a:link,
  a:visited {
    color: #222;
  }
  
  a:hover,
  a:focus {
    color: orange;
  }
  
  .list-group-item span {
    cursor: pointer;
    border: solid #222;
    border-width: 0 1px 1px 0;
    transform: rotate(40deg);
    transition: .3s transform ease-in-out;
    display: inline;
    padding: 3px;
    position: absolute;
    right: 0;
    margin-top: 10px;
  }
  
  .list-group-item .collapsed span {
    transform: rotate(-140deg);
    margin-top: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" /&gt;
  
  &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;div class="container"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col"&gt;
        &lt;div class="my-5"&gt;
          &lt;ul class="list-group list-group-flush"&gt;
            &lt;li class="list-group-item px-0"&gt;
              &lt;a class="btn" data-toggle="collapse" href="#collapseExample1" role="button" aria-expanded="true" aria-controls="collapseExample1"&gt;
                &lt;span class="mr-3"&gt;&lt;/span&gt; Link with href
              &lt;/a&gt;
              &lt;div class="collapse" id="collapseExample1"&gt;
                &lt;div class="card card-body mt-2"&gt;
                  Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class="list-group-item px-0"&gt;
              &lt;a class="btn" data-toggle="collapse" href="#collapseExample2" role="button" aria-expanded="true" aria-controls="collapseExample2"&gt;
              Link with href &lt;span class="mr-3"&gt;&lt;/span&gt;
    &lt;/a&gt;
              &lt;div class="collapse" id="collapseExample2"&gt;
                &lt;div class="card card-body mt-2"&gt;
                  Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class="list-group-item px-0"&gt;
              &lt;a class="btn" data-toggle="collapse" href="#collapseExample3" role="button" aria-expanded="true" aria-controls="collapseExample3"&gt;
      Link with href &lt;span class="mr-3"&gt;&lt;/span&gt;
    &lt;/a&gt;
              &lt;div class="collapse" id="collapseExample3"&gt;
                &lt;div class="card card-body mt-2"&gt;
                  Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>