Bug 226739

Summary: iFramed position:fixed element doesn't show in viewport after page regains focus
Product: WebKit Reporter: Karen <kdolan>
Component: CompositingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: kdolan, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac (Intel)   
OS: macOS 10.15   

Description Karen 2021-06-07 13:55:16 PDT
When an iFramed document contains a position:fixed element inside the scrollable body. The position fixed element moves along with the viewport fine when the page loads and has focus. But, tab away to another tab, then back to the page, and, in Safari, the position:fixed element is hidden at the top of the page. Not at the scrolled position. It's as if the container box is not the viewport anymore but the body.

However, in Safari inspector, the position:fixed element is registering as existing in the viewport area. The position:fixed element's bounding box is in the fixed:position where the element should be visible. But, the position:fixed element is not visible there, its hidden at the top. The element only snaps into the viewport when the body is manually scrolled. Attempting to scroll the body with javascript does not show the position:fixed item in the viewport. This is only an issue in Safari. Firefox and Chrome show the item in its fixed position fine, with no problems, after the page gets focus again.

Example: https://jsfiddle.net/khdolan/o1md489z
In Safari, tab to another page and back to the rendered fiddle to see the issue.
Comment 1 Simon Fraser (smfr) 2021-06-07 14:04:33 PDT
Thanks for the report.
Comment 2 Radar WebKit Bug Importer 2021-06-07 14:04:46 PDT
<rdar://problem/78962618>
Comment 3 Karen 2021-06-15 07:04:57 PDT
Possible related to the new Shadow DOM/Tree changes in Safari? However, this issue only happens when the iFramed page regains focus in Safari.