Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Lack of clarity on how occlusion behavior interacts with iframes #56

Closed
kg opened this issue Nov 14, 2019 · 3 comments
Closed

Lack of clarity on how occlusion behavior interacts with iframes #56

kg opened this issue Nov 14, 2019 · 3 comments
Milestone

Comments

@kg
Copy link

kg commented Nov 14, 2019

The spec was somewhat recently updated (0c5325a) to allow UAs to treat a page as "hidden" if its window is suitably occluded by other windows on the user's machine. It's unclear how this interacts with iframes, as the spec does not address them or 'frames' or 'children' directly and the documentation on MDN states that iframe visibility is not occlusion-based or visibility-based and is instead inherited from the parent document (https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API):

Visibility states of an <iframe> are the same as the parent document. Hiding an <iframe> using CSS properties (such as display: none;) doesn't trigger visibility events or change the state of the document contained within the frame.

Inheriting visibility state from the parent document makes sense when page visibility is about whether a tab is the active tab / whether the browser window is minimized / whether the user's screen is powered off, but when page visibility is about pixel-level occlusion on screen, it becomes surprising for an iframe to have different occlusion behavior from a top-level frame - any web page relying on accurate "i am hidden" notifications will stop getting them if it happens to be embedded in an iframe.

Is MDN's information still correct and the intent of the spec? Is the intent of the spec that child frames should have the same pixel-level occlusion behavior? Is it intended that top-level window occlusion - covering the browser with another window - sets a page as hidden but occluding an iframe with another DOM element or setting it to 'display: none' does not?

@yoavweiss yoavweiss added this to the Level 3 milestone Jan 30, 2020
@plehegar
Copy link
Member

@plehegar
Copy link
Member

and the thread This spec is not optimal for iframes

@yoavweiss
Copy link
Contributor

This was discussed at the WebPerfWG call (twice)

@plehegar pointed you at previous discussions related to this. Otherwise, IntersectionObserver V2 should give you the ability to observe in-page occlusion of certain iframes.

Closing, as this is not actionable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants