Bootstrap 4 alpha 6:展开时并排折叠的两个 div 堆叠在一起

Bootstrap 4 alpha 6: collapsed two divs side by side are stacked when expanded

我正在为一个非关键项目试验 Bootstrap 4 alpha 6,并遇到了一些奇怪的行为。应该并排显示的折叠 div 在展开时堆叠在一起。

以下是重现问题的具体步骤(请参阅下面的完整工作示例):

  1. 创建一个包含两个 col-6 div 的 col-12 div。与我示例中的粉色和黄色 div 一样,两个窄 div 将并排放置。
  2. 在 div 上面添加一个 link 并将其设置为 collapse col-12 div(如 Expand link 在示例中)
  3. 展开 div 时,您会注意到两个 col-6 div 并排显示了一瞬间,然后突然堆叠在一起在另一个之上。

我知道这可能只是一个错误,当 Bootstrap 4 接近最终版本时会被修复,但我想知道是否有人在此期间提出修复此问题的建议。

我确实在我的浏览器开发工具中尝试了各种覆盖 CSS 的排列,但我看不到是什么样式设置使右手 div 像这样落在左手下方,轻微的延迟让我觉得这可能是 JavaScript 的问题。或者可能是我的坏蛋 HTML!

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
  </head>

  <body class="container" style="margin-top: 40px;">
    <div class="row col-12">
      <!-- Title and authors -->
      <h4 class="col">
        <a href="#details" data-toggle="collapse" aria-expanded="true">
            <span>Expand</span>
        </a>
      </h4>
    </div>

    <div id="details" class="row collapse" aria-expanded="true">
      <div class="col col-6" style="background-color: lightblue;">
        <h3>Text on the left</h3>
        <p>Lorem ipsum dolor sit amet, iusto fuisset ea pri.</p>
      </div>

      <div class="col col-6" style="background-color: lightgreen;">
        <h3>Text on the right</h3>
        <p>Cu sed latine tacimates maluisset, nibh.</p>
      </div>
    </div>

    <div class="row" aria-expanded="true">
      <div class="col col-6" style="background-color: lightpink;">
        <h3>Exact same as collapsed area above but no collapse</h3>
        <p>Lorem ipsum dolor sit amet, iusto fuisset ea pri.</p>
      </div>

      <div class="col col-6" style="background-color: lightyellow;">
        <h3>Text on the bottom right</h3>
        <p>Cu sed latine tacimates maluisset, nibh.</p>
      </div>
    </div>
  </body>
</html>

已在 GitHub 上为此打开一个问题:https://github.com/twbs/bootstrap/issues/22600

同时,解决方法是使用..

.row.collapse.show {
    display: flex;
}

http://codeply.com/go/jjHvwkYalf