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

useBeforeUnload's message parameter not used by modern browsers #2623

Open
alvaro450 opened this issue Mar 3, 2025 · 0 comments
Open

useBeforeUnload's message parameter not used by modern browsers #2623

alvaro450 opened this issue Mar 3, 2025 · 0 comments

Comments

@alvaro450
Copy link

Is your feature request related to a problem? Please describe.
The useBeforeUnload hook takes two params:

  1. enabled: boolean | (() => boolean) = true
  2. message: A string to be displayed in the dialog

The problem is that modern browsers do NOT allow a custom message on the dialog that is shown a result of beforeUnload event, making the second parameter irrelevant.

Describe the solution you'd like
Remove the message parameter and default its value to true for legacy browsers. I understand this would be a breaking change, and less desired.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

An alternative is to just update the documentation to indicate message would only be used as a truthy value for event.returnType and its effect will only apply in legacy browsers. Modern browsers will not use the message provided to be displayed in the dialog.

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

1 participant