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

Separate BeforeInstallPrompt from automatic prompt #692

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,16 +443,58 @@ <h2>
</ul>
<p>
Prior to presenting an <a>automated install prompt</a>, a user agent
MUST run the <a>steps to notify that an install prompt is
MAY run the <a>steps to notify that an install prompt is
available</a>, to give the site the opportunity to prevent the
default action (which is to install the application). Alternatively,
the user agent MAY run the <a>steps to notify that an install prompt
is available</a> at any time, giving the site the opportunity to show
a <a>site-triggered install prompt</a> without automatically showing
the prompt.
the prompt. And, the user agent MAY <a>present an install prompt</a>
at any time, without giving the site an opportunity to prevent it (in
this case, it is RECOMMENDED that the automated prompt be minimally
Copy link
Collaborator

Choose a reason for hiding this comment

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

be -> is?

Copy link
Collaborator Author

@mgiuca mgiuca Jun 14, 2018

Choose a reason for hiding this comment

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

Technically "be" is correct. Given it's hard to read this sentence, probably best to rephrase as "the automated prompt SHOULD be minimally..."

Edit: This was bothering me (to explain why it should be "be" not "is"), so I checked. So sentences that start with "it is recommended that" use the mandative subjunctive form of the verb, which means the same as the basic imperative form ("to be"), not the present tense ("is"). So:

  • "It is recommended that he be quiet", not "It is recommended that he is quiet"
  • "It is recommended that she try to eat", not "It is recommended that she tries to eat"

But anyway, I'm just throwing this up as a strawman proposal. I don't intend to commit this in its current form. Just collecting feedback on the proposal.

intrusive, since the site will have no control over when it shows).
</p>
<div class="note">
<p>
The above gives user agents a number of alternatives for
controlling the prompting behaviour:
</p>
<ol>
<li>Don't ever show an automated prompt; dispatch the
<a>BeforeInstallPromptEvent</a>, requiring the site to opt in to
showing a prompt.
</li>
<li>Show an automated prompt, and do not implement
<a>BeforeInstallPromptEvent</a>. The prompt is considered part of
the user agent's user interface, not under the control of the
developer (no different to any other affordance offered by a user
agent).
</li>
<li>Show an automated prompt, and independently, dispatch the
<a>BeforeInstallPromptEvent</a> (perhaps at different times or
under different circumstances). This is just a combination of the
previous two options. The automated prompt might look quite
different to the site-triggered prompt (e.g., being smaller or more
subtle). In this approach, using <a data-cite=
"DOM#dom-event-preventdefault"><code>preventDefault</code></a> on
the <a>BeforeInstallPromptEvent</a> would have no effect, since it
is independent of the automated install prompt.
</li>
<li>Dispatch the <a>BeforeInstallPromptEvent</a>, and if it is not
cancelled, show an automated prompt. In this approach, using
<a data-cite=
"DOM#dom-event-preventdefault"><code>preventDefault</code></a>
would stop the automatic prompt from appearing. User agents that
adopt this approach would need to show a second prompt if the
event's <a data-lt=
"BeforeInstallPromptEvent.prompt()"><code>prompt()</code></a>
method is called (otherwise, the site might show an "Install"
button that does nothing when clicked).
</li>
</ol>
</div>
<p>
In either case, when a user agent <dfn data-lt=
When a user agent <dfn data-lt=
"present an install prompt|presenting an install prompt">presents an
install prompt</dfn>, the end-user's choice is represented either
"accepted" or "dismissed". These values are represented in the API of
Expand Down Expand Up @@ -484,8 +526,7 @@ <h2>
browsing context</a>.
</li>
<li>If <var>mayShowPrompt</var> is true, then the user agent MAY,
<a>in parallel</a>, <a>request to present an install prompt</a>
with <var>event</var>.
<a>in parallel</a>, <a>present an install prompt</a>.
</li>
</ol>
</li>
Expand Down