Created attachment 294157 [details]
Calling element.focus() on an element inside an iframe taller than the viewport causes the parent to scroll to an incorrect position.
1. iframe with content taller than parent viewport (iframe is sized to 100% of its content)
2. iframe has DIV "target" element that sits below viewport page fold
3. Scroll parent page down so "target" element is visible
4. From inside iframe call element.focus() on "target" element
5. The parent page will attempt to scroll the "target" element into view but instead scrolls screen to wrong position so "target" 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.
- 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).
Created attachment 294158 [details]
Issue also occurs when element.scrollIntoView() is called from an iframe.
It's still reproducable on last Webkit version compiled locally.
This was fixed by bug 186956.
*** This bug has been marked as a duplicate of bug 186956 ***