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

[feat] Match JS popup box behavior with browser (alert, prompt and confirm should be sync) #12576

Open
hugoattal opened this issue Jan 30, 2025 · 0 comments

Comments

@hugoattal
Copy link

Describe the problem

I discovered that alert(), prompt() and confirm() returns a promise in Tauri.
I'd love JS to make these functions a promise, but as of right now, they are sync and blocking.

The problem is that a lot of libraries rely on it for stuff like this

if (confirm("Are you sure?")) {
    console.log("You done it!")
}

In the browser:
It will wait for the user input and block the process
If the user click on Yes, it will log You done it!
If the user click on No, it won't log anything

In Tauri:
The user will be asked Are you sure?
And at the same time, it will always log You done it! (since a promise is truthful)

Describe the solution you'd like

I think the default behavior should be the same as the browser.
Another solution would be a flag or a plugin that allow those functions to be sync.

Alternatives considered

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant