Re: [w3c/permissions] Support minimizable request UI with permissions.request() (#76)

> Firefox might consider the "minimizing" as a dismissal of the prompt. I guess that's a UA-specific decision.

That would require a UX change AFAICS which I don't think the spec should force.

> Regarding the changes you asked, I believe the spec supports what you are asking for but let me know if I misunderstood:
> 
>     being aware of the user dismissing:
> 
> navigator.permission.request().then(function(p) {
>   if (p.state == 'prompt') // user dismissed
> });

If we resolve the request with the "prompt" state then how will we resolve when the user re-opens the prompt and chooses to allow/deny. You can't resolve the promise more than once AFAIK.

>     being aware if the user came back and changed the permission
> 
> navigator.permission.request().then(function(p) {
>   p.onchange = function() {
>     // new state will be in p.state
>   };
> });

Sure, but then authors who leave out the onchange handler would miss the accept or deny if the prompt is dismissed first which seems like a footgun. This is why I propose we remove the return value of `request` and force developers to use the code like below to handle changes regardless of whether it came from a request or not.

> This can even be done without requesting:
> 
> navigator.permission.query().then(function(p) {
>   p.onchange = function() {
>     // new state will be in p.state
>   };
> });

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/permissions/issues/76#issuecomment-209008406

Received on Tuesday, 12 April 2016 17:03:50 UTC