<?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>225093</bug_id>
          
          <creation_ts>2021-04-27 00:37:47 -0700</creation_ts>
          <short_desc>Children in absolutely-positioned grid container not aligned vertically</short_desc>
          <delta_ts>2021-05-07 15:46:37 -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>Safari 14</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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>simon.fraser</cc>
    
    <cc>smoley</cc>
    
    <cc>svillar</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1754522</commentid>
    <comment_count>0</comment_count>
    <who name="Tomas Carnecky">tomc</who>
    <bug_when>2021-04-27 00:37:47 -0700</bug_when>
    <thetext>Consider the following code:

---

&lt;style&gt;
  .container {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    place-items: center;
  }
  .element {
    width: 20px;
    height: 20px;
    background: teal;
  }
&lt;/style&gt;

&lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;element&quot; /&gt;
&lt;/div&gt;


---

The teal 20x20 block should be centered in the viewport. Why? Because it is an a grid container that covers the whole viewport (via position:absolute and top,right,bottom,left:0), and that container has display:grid and place-items:center. This works as expected in Chrome and Firefox. However Safari 14 the block is at the top edge of the viewport.t

When I explicitly set a height in .container (eg. height:100vh), then the vertical alignment works. It appears as if Webkit doesn&apos;t calculate the correct height for the grid when it is not explicitly given.


The code is deployed to https://ct704.csb.app, if you want to edit it, you can do so via https://codesandbox.io/s/webkit-abs-grid-container-children-bug-ct704</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1756461</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-05-04 00:38:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/77491570&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1758057</commentid>
    <comment_count>2</comment_count>
    <who name="Smoley">smoley</who>
    <bug_when>2021-05-07 15:46:37 -0700</bug_when>
    <thetext>Thanks for filing, this does not reproduce for me on TOT Safari. Are you able to reproduce this on the latest Safari Technology Preview?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>