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

api.PermissionStatus - Safari always return "prompt" as value for permissionStatus.state #25032

Open
jop-io opened this issue Nov 11, 2024 · 4 comments
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Comments

@jop-io
Copy link

jop-io commented Nov 11, 2024

What type of issue is this?

Browser bug (a bug with a feature that may impact site compatibility)

What information was incorrect, unhelpful, or incomplete?

For geolocation, PermissionStatus.state is always prompt even if permission previously has been granted or denied.

What browsers does this problem apply to, if applicable?

Safari

What did you expect to see?

The corrected state for permission, i.e. prompt, granted (when user previously have granted permission) or denied (when user previously have denied permission).

Did you test this? If so, how?

  1. First run this code. It will prompt the user a request for permission to use geolocation:
navigator.geolocation.getCurrentPosition(
    (geolocationPositionObject) => {
        console.log("Permission granted", geolocationPositionObject);
    },
    (error) => {
        console.error("An error occurred, including denied permission", error);
    }
);

Choose to grant or deny permission when prompted.

  1. Reload the page and run the following code:
navigator.permissions
    .query({ name: "geolocation" })
    .then((permissionStatus) => {
        console.log(permissionStatus.state); // Will always log "prompt"
    }
);
  1. After the page reload, if running the code in the first block again, no prompt will be shown to user and getCurrentPosition will immediately either succeed (if permission previously was granted) or fail (if permission previously was denied).

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus

MDN metadata

MDN page report details
  • Query: api.PermissionStatus
  • Report started: 2024-11-11T13:07:44.669Z
Copy link

This issue was automatically closed because the title was left as the default, and a summary was not added.

If this is not a spam issue, please replace the <SUMMARIZE THE PROBLEM> part of the title with a short summary of the reported issue, and then post a follow-up comment. A maintainer will review your issue and reopen it if needed.

@github-actions github-actions bot added the invalid 🚫 Invalid issues or pull requests (wrong repo, spam, duplicates, etc.). This won't get merged. Sorry! label Nov 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
@jop-io jop-io changed the title api.PermissionStatus - <SUMMARIZE THE PROBLEM> api.PermissionStatus - Safari always return "prompt" as value for permissionStatus.state Nov 11, 2024
@jop-io
Copy link
Author

jop-io commented Nov 11, 2024

Missed the summary in title.

@queengooborg queengooborg reopened this Nov 12, 2024
@queengooborg queengooborg added data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API and removed invalid 🚫 Invalid issues or pull requests (wrong repo, spam, duplicates, etc.). This won't get merged. Sorry! labels Nov 12, 2024
@mdn-bot mdn-bot closed this as completed Nov 12, 2024
@queengooborg queengooborg reopened this Nov 12, 2024
@queengooborg
Copy link
Collaborator

I don't know why this was just closed by the mdn-bot... (CC @caugner)

@caugner
Copy link
Contributor

caugner commented Nov 12, 2024

@queengooborg This looks like a race condition. I have a GitHub project set up with automation that sets the project item status to Done if an issue is closed, and closes the issue if the project item status is set to Done. To avoid this going forward, I have disabled the second automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

No branches or pull requests

4 participants