<?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>184665</bug_id>
          
          <creation_ts>2018-04-16 13:50:57 -0700</creation_ts>
          <short_desc>iframe inside scrollable div scrolls up after inserting element</short_desc>
          <delta_ts>2022-08-29 04:01:39 -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>Frames</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 11</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=61491</see_also>
          <bug_file_loc>https://plnkr.co/edit/HDigw0jKv79J1eI81kDJ?p=preview</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gaffne67</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>gaffne67</cc>
    
    <cc>info</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1414894</commentid>
    <comment_count>0</comment_count>
    <who name="">gaffne67</who>
    <bug_when>2018-04-16 13:50:57 -0700</bug_when>
    <thetext>When moving and displaying a div in an iFrame (using javascript) in iOS devices, the iframe scrolls to top of the window and the user has to scroll back down to see the div. In non-iOS devices the div is moved into view without the iFrame scrolling up (which is the desired behavior).

example: https://plnkr.co/edit/HDigw0jKv79J1eI81kDJ?p=preview

Steps to reproduce:
1. Navigate to the above url on an iPad or iPhone using Safari
2. Scroll down and tap the &quot;Click ME!&quot; link.
3. Notice the iFrame scrolls to the top.

What the link is doing:
- The link formats a div, moves it to the top right of the point that was tapped, and makes it visible.

Note: If you comment out line 82 (dd.style.display = &quot;block&quot;;), the iframe does not scroll to the top.

I confirmed this behavior on:
iPad (iOS 11.3)
- Safari
- Chrome
- Mozilla Firefox
iPad (iOS 11.2.6)
- Safari
- Chrome
- Mozilla Firefox
iPhone (iOS 11.2.6)
- Safari

I confirmed this behavior does not happen on:
Windows 10
- Safari (v 5.1.7)
- Chrome
- Mozilla Firefox
Android (7.0)
- Chrome</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414898</commentid>
    <comment_count>1</comment_count>
      <attachid>338036</attachid>
    <who name="">gaffne67</who>
    <bug_when>2018-04-16 13:56:27 -0700</bug_when>
    <thetext>Created attachment 338036
Example

Run index.html on iPad then follow steps in the bug&apos;s initial comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1416271</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-04-20 08:46:11 -0700</bug_when>
    <thetext>&lt;rdar://problem/39597937&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477674</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-11-12 12:55:32 -0800</bug_when>
    <thetext>I can reproduce.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477689</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-11-12 13:13:20 -0800</bug_when>
    <thetext>Inserting the div is triggering layout in the main document (because of frame flattening), and this is resetting the scroll position.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477714</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-11-12 13:49:03 -0800</bug_when>
    <thetext>What seems to be happening is that we do two layouts on the scrollable div. The first is with an unflattened frame, so the contents height is ~300 and we clamp the larger scroll position. Then we do layout again with at the unflattened frame, and go back to larger contents size, but we&apos;ve already clamped the scroll position.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477730</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-11-12 14:21:12 -0800</bug_when>
    <thetext>Actually, I think the real bug is that RenderIFrame::flattenFrame() says to not flatten the frame if boundingRect (the unflattened size!) is outside the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477738</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2018-11-12 14:41:28 -0800</bug_when>
    <thetext>Probably caused by https://trac.webkit.org/changeset/88011/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1497963</commentid>
    <comment_count>8</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2019-01-24 14:33:41 -0800</bug_when>
    <thetext>*** Bug 193769 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1497964</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2019-01-24 14:34:04 -0800</bug_when>
    <thetext>Another test case at https://plnkr.co/edit/HDigw0jKv79J1eI81kDJ?p=preview</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1894479</commentid>
    <comment_count>10</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-29 04:01:31 -0700</bug_when>
    <thetext>I am unable to reproduce this bug using test link in Comment 0 and Comment 9 on iOS 15.6.1 on iPhone 13 Pro Max.

It does not scroll back at the top when clicking on &quot;Click Me&quot; to show &lt;div&gt;.

I am going to mark this as &quot;RESOLVED CONFIGURATION CHANGED&quot;. Please reopen with updated test case, if this is still happening for anyone else.

I don&apos;t have iPad to test this but iPhone is working as intended and matching Safari on macOS behavior. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>338036</attachid>
            <date>2018-04-16 13:56:27 -0700</date>
            <delta_ts>2018-04-16 13:56:27 -0700</delta_ts>
            <desc>Example</desc>
            <filename>example.zip</filename>
            <type>application/x-zip-compressed</type>
            <size>2196</size>
            <attacher>gaffne67</attacher>
            
              <data encoding="base64">UEsDBBQAAAAIAKKBkEzSCB3p3QEAAAsFAAAKAAAAaW5kZXguaHRtbLVUTW/bMAy9D9h/0HTqgGhJ
l8OGxDJQbAvQ+wbsKlt0JEwSXVl2kv760R9LUyTN1sMEwwDJR+nxUVRmknd5ZkDp/O2bzENSrDQq
NpAkb1MlPvOj36RUC3hobSf5T/HjTnxBX6tkCweclRgSBEq6/yZBb2FWmoge5O1TflBk887CrsaY
TlJ2VicjNXS2BDEYMxtsssqJplSONpkxr/bWt/7EYcNzR9tAHCxFhGTACUKbtJbn2TshvhvbMPoS
siGLJQOsVlv6RawhugOrMDKPhaXgyKcRoi9gPinEaGUF6gNr0oGO4dhBrBzuVsxYrSGsaUOtbdiK
aLcmrdjtp3q/7kWYks0yv99EkoJtHMHYV/DIbjYqlIcC9+/ppOURfLoybTtWOtU0klcTWtgQIPJz
LqpNuGaDlCu2XCyIAjMwEprMAqMmwRLWYsJ9PHEP5C8FCkwJ/aWIg+p5hthB8csm8YcWNSei64te
UQva0vD8vMyhVFsNAl2O9msq+L/XwF+mcNaKgTO/QnoAjAdJvriG7JpalfAXkPkX0NgC5Uj+qnWO
OgAQJL+W4vHxVfhXgY9XQPL+jl6FxlLyUVVNM/Khf6le6EeezUfghQuVzWlwnvzTFM77GR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