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

Update navigator.canShare, navigator.share, Web Share API #8381

Merged
merged 28 commits into from
Aug 31, 2021

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Aug 27, 2021

Further updates to navigator.canShare.

The main reason is that following some digging, I have verified that the message is a bit flawed. Essentially it can return invalid true if it does not understand data. It is however useful for feature detection.
I added a simple example using pseudo code for that, and explained it.

Also removed the non-standard header and experimental flag. IMO it is not to either - though I am testing that in BCD. BCD also has spec update.

Also noted that the value for the data is a "base set". This can be extended. Lots of work to be done in Web Share API doc (still to be created).

@hamishwillee hamishwillee requested a review from a team as a code owner August 27, 2021 07:34
@hamishwillee hamishwillee requested review from wbamberg and removed request for a team August 27, 2021 07:34
@github-actions
Copy link
Contributor

github-actions bot commented Aug 27, 2021

Preview URLs

Flaws

Note! 2 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/Web_Share_API
Title: Web Share API
on GitHub
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/API/Web_Share_Target_API

External URLs

URL: /en-US/docs/Web/API/Navigator/canShare
Title: Navigator.canShare()
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/Navigator/share
Title: Navigator.share()
on GitHub


URL: /en-US/docs/Web/API/Web_Share_API
Title: Web Share API
on GitHub

(this comment was updated 2021-08-31 02:53:55.405504)

files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
The <strong><code>canShare()</code></strong> method will return <code>false</code> if the permission is supported on the platform but has not been granted.</p>

<p>The method will generally also return <code>false</code> if the implementation does not support sharing of an indicated data type, for example files, or if sharing that data type would be considered a "hostile share" by the user-agent.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@saschanaz

  • This attempts to capture some general guidance about what might cause false to be returned.
  • Is this a reasonable statement? I know that it is true for files - but is it the intent of the API?
  • When you refer to "implementation" in the spec about files perhaps not being shareable, do you mean "the user agent" or the underlying OS to which the share data is being passed?
  • The term "hostile share" is used in the spec. I can imagine what it would mean, but does not appear to be defined. Is there one that I am missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

The statement is now changed so I'll only answer the last two ones.

When you refer to "implementation" in the spec about files perhaps not being shareable, do you mean "the user agent" or the underlying OS to which the share data is being passed?

Kinda both, the OS or the user agent not supporting the OS feature properly.

The term "hostile share" is used in the spec. I can imagine what it would mean, but does not appear to be defined. Is there one that I am missing?

That's from w3c/web-share#127 but admittedly it's way too vague. Filed w3c/web-share#217

@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Aug 30, 2021

@saschanaz @jpmedley Thanks for the review - adjusted to address your points. A few specifics:

  • Removed the info about dependency on Permission API. There is no web-share permission - just a web share "permission policy" permission.
  • Does not talk about future extensions, though it does still mention base set of options.
  • I now use the terminology recognized or understood to indicate whether a property is understood by the user agent, known/supported mean further than the user agent knows about them. I thought about "valid" and "invalid" but then we run into the issue that the spec users validate for share data (gets a bit messy).
  • I added a clarification of what is likely to return false in Update navigator.canShare, navigator.share, Web Share API #8381 (comment)

In addition, I have added docs for navigator.share() and Web Share API to this too.

@hamishwillee hamishwillee changed the title Further clarifications on navigator.canShare Update navigator.canShare, navigator.share, Web Share API Aug 30, 2021
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/navigator/canshare/index.html Outdated Show resolved Hide resolved

<p>The available share targets are provided using the native mechanisms of the underlying operating system. They might, for example, include the system clipboard or other services, Bluetooth or WiFi, email, contacts or messaging applications, and websites.</p>

<p>The API consists of just two methods:</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please format this like the other API overview pages. Here's an example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. I copied the Battery Status API - in retrospect, perhaps not a good choice.

files/en-us/web/api/web_share_api/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/web_share_api/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/web_share_api/index.html Outdated Show resolved Hide resolved
files/en-us/web/api/web_share_api/index.html Outdated Show resolved Hide resolved
@hamishwillee
Copy link
Collaborator Author

Thanks for review @jpmedley. Since then ...

  • I accepted all your suggestions (with some minor qualifications). Github wouldn't let me batch merge them - sorry if you got multiple notifications.
  • Updated the top level API landing page to match the 'standard'
  • Removed the link to web tests

@jpmedley jpmedley merged commit a0e1630 into mdn:main Aug 31, 2021
@jpmedley
Copy link
Collaborator

Thanks for your patience.

@hamishwillee hamishwillee deleted the webshare_updates branch September 1, 2021 08:36
@hamishwillee
Copy link
Collaborator Author

Thanks for yours @jpmedley - much appreciated.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants