<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>224424</bug_id>
          
          <creation_ts>2021-04-12 02:04:47 -0700</creation_ts>
          <short_desc>Grid element retains dimensions after its children are removed, children are not rendered anymore</short_desc>
          <delta_ts>2021-04-19 02:05:13 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tomas Carnecky">tomc</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>jfernandez</cc>
    
    <cc>rego</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>svillar</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
    
    <cc>zsun</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1749160</commentid>
    <comment_count>0</comment_count>
    <who name="Tomas Carnecky">tomc</who>
    <bug_when>2021-04-12 02:04:47 -0700</bug_when>
    <thetext>I have a horizontally scrollable list of cards, and a toggle button which removes/adds the cards from the container. When the cards are removed, the container becomes an div with no children. On Safari, clicking the button to remove the cards removes the children, but the container retains its original dimensions. Furthermore, the label from the button disappears (possibly a completely unrelated bug).

A repro case is here: https://vvugb.csb.app. Click the button and observe how the container doesn&apos;t shrink vertically. The &lt;hr&gt; is placed after the container, so it should move up, but doesn&apos;t. Clicking the button again to show the cards doesn&apos;t work anymore, the cards are inserted into the DOM but not rendered.

You can see the code here: https://codesandbox.io/s/peaceful-morning-vvugb?file=/src/App.tsx.

A couple notes:

 - If I remove overflowX:auto from the container, the bug disappears.
 - If I remove the card with the longest name ({ name: &quot;Excepteur sint occaecat cupidatat non proident&quot; }), the bug disappears (possibly bug is present whenever the text wraps to multiple lines?)
 - Resizing the viewport fixes the bug temporarily (I guess because it triggers a layout/render of the whole viewport).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749295</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-04-12 11:31:32 -0700</bug_when>
    <thetext>Does this happen when not using grid layout?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749687</commentid>
    <comment_count>2</comment_count>
    <who name="Tomas Carnecky">tomc</who>
    <bug_when>2021-04-13 08:30:11 -0700</bug_when>
    <thetext>@smfr, no, if I change display:grid to display:flex on line 15 (the display of the card container), then the bug disappears.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1751707</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-04-19 02:05:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/76835522&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>