title: Flex items not shrinking when window gets smaller
body: <p>I'm trying to fit two plotly plots next to each other inside a CSS flexbox. I want them to resize when the window is resized. It works as expected when the window grows, but the plots don't shrink when the window gets smaller.</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-js lang-js prettyprint-override"><code>var trace1 = {};
  var trace2 = {};
  
  var plotdiv1 = document.getElementById("plotdiv1");
  var plotdiv2 = document.getElementById("plotdiv2");
  
  Plotly.newPlot(plotdiv1, [trace1]);
  Plotly.newPlot(plotdiv2, [trace2]);
  
  window.addEventListener("resize", function() {
    Plotly.Plots.resize(plotdiv1);
    Plotly.Plots.resize(plotdiv2);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.plot-div {
    max-width: 100%;
  }
  .plot-col {
    flex: 0 0 50%;
  }
  .my-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    height: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdn.plot.ly/plotly-latest.min.js"&gt;&lt;/script&gt;
  
  &lt;body&gt;
    &lt;div class="my-container"&gt;
      &lt;div class="plot-col"&gt;
        &lt;div id="plotdiv1" class="plot-div"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="plot-col"&gt;
        &lt;div id="plotdiv2" class="plot-div"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>JSFiddle: <a href="https://jsfiddle.net/bd0reepd/" rel="noreferrer">https://jsfiddle.net/bd0reepd/</a></p>
  
  <p>I am probably misunderstanding how flexbox works, but if I replace the plots with images, they shrink as expected.</p>
  
  <p>I have tried to debug this and found plotlys internal function <code>plotAutoSize</code>, which calls <code>window.getComputedStyle</code> and sets the plot size accordingly. I have used <code>console.log</code> to look at the return values of <code>window.getComputedStyle</code> and they get "stuck" at the largest size when the window shrinks.</p>
  
  <p>How can I get the plots to shrink to fit the window and stay next to each other in the same row?</p>