<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - element.focus() inside tall iframe scrolls parent to incorrect screen position"
   href="https://bugs.webkit.org/show_bug.cgi?id=164512">164512</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>element.focus() inside tall iframe scrolls parent to incorrect screen position
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari 10
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>iPhone / iPad
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>iOS 10
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>HTML DOM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>coridyn+bugzilla&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>cdumez&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=294157" name="attach_294157" title="iframecontent.html">attachment 294157</a> <a href="attachment.cgi?id=294157&amp;action=edit" title="iframecontent.html">[details]</a></span>
iframecontent.html

Calling element.focus() on an element inside an iframe taller than the viewport causes the parent to scroll to an incorrect position.

Scenario: 

1. iframe with content taller than parent viewport (iframe is sized to 100% of its content)
2. iframe has DIV &quot;target&quot; element that sits below viewport page fold
3. Scroll parent page down so &quot;target&quot; element is visible
4. From inside iframe call element.focus() on &quot;target&quot; element
5. The parent page will attempt to scroll the &quot;target&quot; element into view but instead scrolls screen to wrong position so &quot;target&quot; element is no longer visible.

With this issue it's not possible to set focus on an HTML element without the target element being scrolled off-screen.

Notes:

 - The issue occurs in iOS 10.1.1 and iOS 10.2 beta 2.
 - The issue doesn't occur in iOS 9.3.2.
 - The issue only occurs when focussing on non-input HTML elements e.g. DIV, SPAN, anchor tags.
 - The issue doesn't occur when setting focus on INPUT elements (parent page scrolls to the correct location).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>