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

BeforeInstallPromptEvent: Should prompt() throw InvalidStateError if preventDefault not called? #577

Closed
mgiuca opened this issue May 10, 2017 · 3 comments
Assignees

Comments

@mgiuca
Copy link
Collaborator

mgiuca commented May 10, 2017

A previous draft of the spec included this language in the prompt method:

If the canceled flag is unset, throw an InvalidStateError, optionally with the message informing the developer that .prompt() needs to be called after .preventDefault().

This text didn't make it into the final version -- I actually didn't notice it disappearing. Was it intentional?

Chrome's implementation does currently throw InvalidStateError in this case. However, on reflection, especially if #576 is actioned, it doesn't make sense to throw an error if preventDefault is not called (since the default behaviour may in fact not be to show a prompt, and therefore it's sensible to call prompt without preventDefault). In that case, this is a WontFix.

@mgiuca mgiuca changed the title BeforeInstallPromptEvent: Should prompt throw InvalidStateError if preventDefault not called? BeforeInstallPromptEvent: Should prompt() throw InvalidStateError if preventDefault not called? May 10, 2017
@marcoscaceres
Copy link
Member

This text didn't make it into the final version -- I actually didn't notice it disappearing. Was it intentional?

No.

Plus I'd be supportive that the spec to reflect whatever Chrome is doing.

@mgiuca
Copy link
Collaborator Author

mgiuca commented May 15, 2017

We can also change Chrome -- this is straightforward since it removes an error case (shouldn't break anything).

I'd like to decide what to do with #576 first. If we allow the default behaviour to not prompt, then it doesn't make sense to have to call preventDefault before prompt.

@mgiuca
Copy link
Collaborator Author

mgiuca commented Jun 8, 2017

#576 is resolved and the spec no longer requires the beforeinstallpromptevent default action to be showing an install prompt. Therefore, it is no longer sensible to require preventDefault before prompt is called (or in other words, it now makes sense to call prompt without preventDefault).

I've filed a Chrome bug crbug.com/730993 to remove this requirement. Let's close this spec bug as WontFix (Chrome will match the existing text).

@mgiuca mgiuca closed this as completed Jun 8, 2017
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

No branches or pull requests

2 participants