Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass as adding a Client Hint for Display Mode #977

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

aarongustafson
Copy link
Collaborator

@aarongustafson aarongustafson commented May 7, 2021

Closes #954

This change (choose at least one, delete ones that don't apply):

  • Adds new normative requirements

Implementation commitment (delete if not making normative changes):

  • Safari (link to issue)
  • Chrome (link to issue)
  • Firefox (link to issue)
  • Edge (public signal)

Commit message:

Adds a Client Hint to reveal the Display Mode being used by the user agent.

Person merging, please make sure that commits are squashed with one of the following as a commit message prefix:

  • chore:
  • editorial:
  • BREAKING CHANGE:
  • And use none if it's a normative change

Preview | Diff


Preview | Diff

@aarongustafson
Copy link
Collaborator Author

Had a few moments to put this together, based on what I’ve been working on in the App Info doc.

@aarongustafson
Copy link
Collaborator Author

aarongustafson commented May 7, 2021

Note: Validation is failing due to a current issue with the spec, where [=link type "manifest"=] is undefined. This reference appears in 3 places.

Copy link
Member

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

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

Thanks for crafting this @aarongustafson! Looking pretty good.

I'm wondering if we need to say exactly when this hint is sent (I imagine that must be part of client-hints-infrastructure spec)? Like, how does the user agent know to send it on page load or whatever...

Once we clean this up a little bit, might be great to have @yoavweiss take a look at it and make sure we have all the right machinery in place.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
The header's ABNF is:
</p>
<pre>
Sec-CH-Display-Mode = sf-string
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be

Suggested change
Sec-CH-Display-Mode = sf-string
Sec-CH-Display-Mode = "fullscreen" / "standalone" / "minimal-ui" / "browser"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I’m apprehensive about locking this down to specific values, especially as the display mode may be one of the overrides not defined in this list.

Copy link
Member

Choose a reason for hiding this comment

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

ah, well we should just expand the list. We can update the spec at any time, so there is no reason not to keep this list in sync.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we would also want to have this possibly be values that end up in manifest-incubations spec - not sure the best way to do this spec-wise, but referencing display-mode is probably a good way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to keep this extensible, hence: "whose value is a suitable [=display modes value=]"

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@tomayac
Copy link
Contributor

tomayac commented May 11, 2021

I'm wondering if we need to say exactly when this hint is sent (I imagine that must be part of client-hints-infrastructure spec)? Like, how does the user agent know to send it on page load or whatever...

No need. This is specified in client hints. If it needs to be sent upon the first load, it's a critical client hint. Any client hint can be promoted to be a critical client by mentioning it in the critical-ch header.

Once we clean this up a little bit, might be great to have @yoavweiss take a look at it and make sure we have all the right machinery in place.

(I'm working with Yoav on User Preference Media Features Client Hints Headers.)

@marcoscaceres
Copy link
Member

Ok, perfect! glad to have your support/review @tomayac on the CH front.

@marcoscaceres
Copy link
Member

IIUC, we have a concerns from Mozilla (via @annevk) about Client Hints (w3c/manifest-app-info#32 (comment)):

We're not convinced Client Hints is worthwhile and are concerned about its implications on the same-origin policy.

I'd be interested to hear from Apple, maybe @hober or @rniwa if they have an objection or concerns?

aarongustafson and others added 6 commits May 25, 2021 11:23
Co-authored-by: Marcos Cáceres <[email protected]>
Co-authored-by: Marcos Cáceres <[email protected]>
Co-authored-by: Marcos Cáceres <[email protected]>
Co-authored-by: Marcos Cáceres <[email protected]>
Co-authored-by: Marcos Cáceres <[email protected]>
@aarongustafson
Copy link
Collaborator Author

IIUC, we have a concerns from Mozilla (via @annevk) about Client Hints (w3c/manifest-app-info#32 (comment))

Yes, the concerns are around potential bloat in the request header. That’s not something we can really address in this context (and is being addressed in the Client Hints discussions). As there is no other way to inform the server about the display mode without involving headers, I don’t know that there is another way to solve for this use case.

@aarongustafson
Copy link
Collaborator Author

Note to self: Will need to update this PR to reference the display_override calculation if #932 lands first.

Copy link
Collaborator

@dmurph dmurph left a comment

Choose a reason for hiding this comment

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

This change looks good, but as @marcoscaceres referenced - we don't have signals from other vendors. If we need a place for this spec to live in the meantime we can put it in manifest-incubations

The header's ABNF is:
</p>
<pre>
Sec-CH-Display-Mode = sf-string
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we would also want to have this possibly be values that end up in manifest-incubations spec - not sure the best way to do this spec-wise, but referencing display-mode is probably a good way.

@aarongustafson
Copy link
Collaborator Author

in the meantime we can put it in manifest-incubations

https://github.com/WICG/manifest-incubations/blob/gh-pages/display_mode-client-hint.md

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

Successfully merging this pull request may close these issues.

Allow setting an HTTP request for server side PWA detection
4 participants