react-router icon indicating copy to clipboard operation
react-router copied to clipboard

fix: replace beforeunload to pagehide for safafi on ios

Open jakkku opened this issue 3 years ago • 2 comments

Fixes #9463

here is the codesandbox please check it in safari on ios

beforeunload event does not occur in safari on ios Apple's documentation says to use pagehide instead of unload.

unload Deprecated, use pagehide instead.

the mdn documentation says

When the user clicks the browser's back button, the page hide event is fired on the current page before the previous page is displayed.

So I think it would be okay to use pagehide instead of beforeunload.

This is my first time working in react-router's codebase. Please let me know if there are any additional considerations

jakkku avatar Oct 30 '22 05:10 jakkku

🦋 Changeset detected

Latest commit: 29077f4e7c61b48991255cf02bc663089f3c661e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router-dom Patch
react-router Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 30 '22 05:10 changeset-bot[bot]

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

remix-cla-bot[bot] avatar Oct 30 '22 06:10 remix-cla-bot[bot]

Thanks @jakkku! We can't change useBeforeUnload directly since that would be a breaking change, but we can look into using the pagehide event inside <ScrollRestoration>. I'm going to merge this into a branch of mine to make those changes and do some testing.

brophdawg11 avatar Jan 19 '23 18:01 brophdawg11