Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

useBeforeUnload's message parameter not used by modern browsers

Aperta
#2,623 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
32/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Start by locating the useBeforeUnload hook and its documentation, then inspect any related tests or examples; the issue names no files or test entry points. Compare the current parameter behavior with the documented API and determine whether the project wants an API change or documentation clarification. Done means the chosen behavior is reflected consistently in the hook, documentation, and relevant tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
44k
Fork
3.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di streamich/react-use

Tutte le issue di streamich/react-use

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.