<?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>254868</bug_id>
          
          <creation_ts>2023-04-01 07:09:29 -0700</creation_ts>
          <short_desc>Incorrect height values when viewport-fit=cover is set for installed web apps</short_desc>
          <delta_ts>2025-11-18 11:04:27 -0800</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 16</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=255852</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=210009</see_also>
          <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>ik</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>jcheung23</cc>
    
    <cc>matan.hershberg</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1945954</commentid>
    <comment_count>0</comment_count>
    <who name="">ik</who>
    <bug_when>2023-04-01 07:09:29 -0700</bug_when>
    <thetext>Several css values and javascript APIs report incorrect height values for installed web apps when &lt;meta name=&quot;content&quot;&gt; has &quot;viewport-fit=cover&quot;.

The following values report heights of the available space *minus* safe-area-inset:

- 100svh
- -webkit-fill-available
- visualViewport.height

Note: It&apos;s very likely that this list is not complete, it&apos;s just what I ran into.

The workaround for CSS is fairly easy (but should not be needed):

```css
/* Use svh (with fallback for older versions) in regular safari: */
html, body {
  min-height: -webkit-fill-available;
  min-height: 100svh;
}

/* Switch to &apos;vh&apos; when in standalone: */
@media all and (display-mode: standalone) {  
  html, body {
    min-height: 100svh;
  }
}
```

I&apos;m not sure if there is a workaround for visualViewport.height though...

Related:
https://bugs.webkit.org/show_bug.cgi?id=237961</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1945972</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-04-01 11:15:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/107512425&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1945975</commentid>
    <comment_count>2</comment_count>
    <who name="">ik</who>
    <bug_when>2023-04-01 11:21:50 -0700</bug_when>
    <thetext>Ah just now noticed a typo in my example/workaround code.

For standalone display-mode, it should use &apos;vh&apos; units as that does include safe-area-inset:

```
/* Switch to &apos;vh&apos; when in standalone: */
@media all and (display-mode: standalone) {  
  html, body {
    min-height: 100vh; /* &lt;== should be &apos;vh&apos;, not &apos;svh&apos;
  }
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1946016</commentid>
    <comment_count>3</comment_count>
    <who name="">ik</who>
    <bug_when>2023-04-02 01:27:45 -0700</bug_when>
    <thetext>Note: WebKit currently has a bug where safe-area-inset-bottom doesn&apos;t update then the keyboard is visible (https://bugs.webkit.org/show_bug.cgi?id=217754), so please make sure that the height reported:

- does include safe-area-inset-* when the keyboard is NOT visible
- does NOT include safe-area-inset-bottom when the keyboard IS visible
- there may be other cases where safe-area-inset should NOT be included

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2108103</commentid>
    <comment_count>4</comment_count>
    <who name="">ik</who>
    <bug_when>2025-04-02 00:04:48 -0700</bug_when>
    <thetext>This is still an issue on iOS 18.3.1 (haven&apos;t tested with 18.4 yet).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2111768</commentid>
    <comment_count>5</comment_count>
    <who name="">ik</who>
    <bug_when>2025-04-18 01:46:19 -0700</bug_when>
    <thetext>I think `inset` is affected as well when in standalone and viewport-fit=cover.

I expect the following element to stick to the bottom of the display

```css
.stick-to-bottom {
  position: absolute;
  inset: auto 0 0;
}
```

But the element sits above the bottom (haven&apos;t checked the exact offset, but looks to be the safe-area-insets top and bottom from eyeballing it). Switching to `position: fixed;` fixes it (which is funny, because it says `fixed` :P)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>