<?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>226689</bug_id>
          
          <creation_ts>2021-06-05 17:08:59 -0700</creation_ts>
          <short_desc>visualViewport.height changes and resize events fired when viewport height is not changing</short_desc>
          <delta_ts>2023-08-28 11:55:19 -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>iPhone / iPad</rep_platform>
          <op_sys>iOS 14</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="John Crim">john.crim</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</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>1767165</commentid>
    <comment_count>0</comment_count>
    <who name="John Crim">john.crim</who>
    <bug_when>2021-06-05 17:08:59 -0700</bug_when>
    <thetext>On iOS and iPadOS, using Safari 14 on iOS 14:

After scrolling to the bottom of the page with the on-screen keyboard displayed, while scrolling up with ones finger kept on the screen, visualViewport.height increases with scrolling while there is no change to the actual viewport height; and, many visualViewport.resize events are raised while they should not be.

This bug does not occur:
* When the on-screen keyboard is not displayed
* When scrolling down
* After the finger is removed from the screen, while scrolling up

I&apos;ve create a test page which shows it clearly:

https://cdpn.io/jcrim/debug/JjWvMEo/RBAOJRxOZjnr

You can view the test page source code or edit it here:

https://codepen.io/jcrim/pen/JjWvMEo

Repro steps (on iOS or iPadOS) :
# Click on a text input to make the on-screen keyboard appear
# Scroll down to bottom of viewport
# While scrolling up from bottom of viewport, leave finger on screen (while slowly dragging down to scroll). View `visualViewport.height` and resize events to see bug.
# After releasing finger from scrolling up, notice that `visualViewport.height` changes to the correct value (matching the actual height of the layout viewport).

*The Bug* is that visualViewport resize events are occurring, and the visualViewport.height value is increasing while dragging, even though the height of the viewport is the same size.

*Expected behavior:* visualViewport.height does not increase, and visualViewport.resize events are not raised, when the actual viewport is not changing size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1767225</commentid>
    <comment_count>1</comment_count>
    <who name="John Crim">john.crim</who>
    <bug_when>2021-06-06 11:04:30 -0700</bug_when>
    <thetext>It looks like the first codepen link doesn&apos;t last, so please use this link to view the bug instead (it&apos;s easier than messing with codepen, particularly on mobile devices):

https://johncrim.github.io/bug-safari-vvp-scroll/

Source code is here:

https://github.com/johncrim/bug-safari-vvp-scroll</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1767487</commentid>
    <comment_count>2</comment_count>
    <who name="John Crim">john.crim</who>
    <bug_when>2021-06-07 10:15:02 -0700</bug_when>
    <thetext>I created a video demonstrating this bug, as well:

https://photos.app.goo.gl/oWSZJDwvG1yADqxr6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769229</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-06-12 17:09:19 -0700</bug_when>
    <thetext>&lt;rdar://problem/79247949&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1973987</commentid>
    <comment_count>4</comment_count>
    <who name="John Crim">john.crim</who>
    <bug_when>2023-08-28 11:55:19 -0700</bug_when>
    <thetext>This issue still exists in Safari on iPadOS 16.6.

Note also that when this bug is happening (scrolling up from bottom with on-screen keyboard active), not only does the `visualViewport.height` continue to grow, but `window.innerHeight` returns the same value as `visualViewport.height`.  This is clearly wrong, because the on-screen keyboard is showing, so the visualViewport height is the height of the keyboard shorter than `window.innerHeight`. I can take another video of this behavior if it helps.

When I stop dragging + scrolling up, the values return to expected values.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>