Skip to content

Define Page Visibility in terms of HTML#7238

Merged
domenic merged 1 commit into
whatwg:mainfrom
noamr:visibility-2
Nov 3, 2021
Merged

Define Page Visibility in terms of HTML#7238
domenic merged 1 commit into
whatwg:mainfrom
noamr:visibility-2

Conversation

@noamr

@noamr noamr commented Oct 18, 2021

Copy link
Copy Markdown
Contributor
  • Expose the necessary attributes in the document WebIDL
  • Define "system visibility state" and document "visibility state"
    to represent the algorithms for updating the visibility
  • Update current reference of "page is in the background" to refer
    to the new definitions.

To fully integrate specs referring to the Page Visibility spec
with the changes in the HTML spec, i.e. defining the visibilitychange
event, the different specs need to be called explicitly when the
visibility of the page changes.

For that, the visibilityState of the document needs to be properly
defined within HTML.

See w3c/page-visibility#74
and w3c/page-visibility#73

(See WHATWG Working Mode: Changes for more details.)


/browsers.html ( diff )
/browsing-the-web.html ( diff )
/dnd.html ( diff )
/dom.html ( diff )
/index.html ( diff )
/interaction.html ( diff )
/references.html ( diff )
/webappapis.html ( diff )

@yoavweiss yoavweiss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-authoritative LGTM with a few nits

Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

Comment thread source Outdated
Comment thread source Outdated
Comment thread source
Comment thread source
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
Comment thread source Outdated
@annevk

annevk commented Oct 27, 2021

Copy link
Copy Markdown
Member

Thanks for working on this! Does this help with or impact #3957?

@noamr

noamr commented Oct 27, 2021

Copy link
Copy Markdown
Contributor Author

Thanks for working on this! Does this help with or impact #3957?

It would probably make #3957 marginally easier to implement
But wouldn't affect it otherwise

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very nice. I guess we should not merge until w3c/page-visibility#74 is resolved affirmatively? Let us know the latest on that per the TPAC discussions.

It'd be a nice bonus if we followed this up by inverting the device posture/screen orientation/web NFC hooks, maybe with some extra infrastructure since device posture and screen orientation also use "the next animation frame task" which has its own rigor issues. But this is a strict improvement on the status quo and fixing those specs to be perfectly rigorous is probably lower priority than other work you have been doing :).

@noamr

noamr commented Oct 29, 2021

Copy link
Copy Markdown
Contributor Author

LGTM, very nice. I guess we should not merge until w3c/page-visibility#74 is resolved affirmatively? Let us know the latest on that per the TPAC discussions.

It was resolved affirmatively at TPAC. @yoavweiss would you please comment on that one?

It'd be a nice bonus if we followed this up by inverting the device posture/screen orientation/web NFC hooks, maybe with some extra infrastructure since device posture and screen orientation also use "the next animation frame task" which has its own rigor issues. But this is a strict improvement on the status quo and fixing those specs to be perfectly rigorous is probably lower priority than other work you have been doing :).

I have opened issues for those specs to do it and I will provide some guidance 😀

Not sure what the thought is about referring to e.g. WebNfc from HTML, when it's a standard that doesn't have implementer consensus. But I will leave it to owners of those specs

@yoavweiss

Copy link
Copy Markdown
Contributor

It was resolved affirmatively at TPAC. @yoavweiss would you please comment on that one?

Commented. This is fine to merge even though there are still WG mechanics to figure out about the old spec.

Defines the document.hidden and document.visibilityState APIs in the HTML Standard, while improving their definitions to be more rigorous. This is similar to 3285b98 which did the same for the visibilitychange event.

Also updates the discussion of "page is in the background" to refer to the new definitions.

See w3c/page-visibility#74 and w3c/page-visibility#73 for more background.
@marcoscaceres

Copy link
Copy Markdown
Member

Ooops, we forgot to actually export "visibility state", [=Document/hidden=] and [=Document/visible=]. There are quite a few specs depends on those.

@marcoscaceres

Copy link
Copy Markdown
Member

Sent #7337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants