You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If canDeactivate() returns false it doesn't fire again when using the navigation buttons, back and forward.
The navigation history in the browser changes, you can see the navigation buttons get disabled and enabled when you reach the edges of the history object, when using the navigation buttons, however the route inside the aurelia app doesn't change. If you came from a different site and navigate back enough times the browser will navigate to that site as it normally would.
canDeactivate() does fire again if you reload the page, click a link, or enter a url in the browser.
If choosing "ok" the navigation happens and the canDeactivate() fires again the next time you come back to the page and try to navigate again.
Expected/desired behavior:
canDeactivate() should fire every time you try to navigate away from a page. In this example the confirm popup should show every time I hit back or forward.
Add the following to a view model class: canDeactivate() { return confirm('you wanna leave?'); // if you hit 'cancel' here, canDeactivate() won't fire again when using navigation buttons }
Navigate to the route
Try navigating away from it using any method
Select "cancel" in the confirm popup
Try to navigate again using back or forward in the browser or on the mouse
canDeactivate() is now skipped. Aurelia navigation is disabled but browser navigation occurs.
Can't reproduce in gist because it involves navigation using back and forward.
What is the motivation / use case for changing the behavior?
I make a check for unsaved data in a form and prompt the users if they really want to leave if there are any. If they hit "cancel" they should be prompted again if they try to navigate away again until they either save the data or click "ok" in the prompt.
The text was updated successfully, but these errors were encountered:
I'm submitting a bug report
1.1.0
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
6.9.4
4.1.2
JSPM 0.16.52
Browser:
Chrome 56.0.2924.87
Firefox 51.0.1 (32 bit)
Language:
TypeScript 2.1.5
Current behavior:
Expected/desired behavior:
canDeactivate() should fire every time you try to navigate away from a page. In this example the confirm popup should show every time I hit back or forward.
canDeactivate() { return confirm('you wanna leave?'); // if you hit 'cancel' here, canDeactivate() won't fire again when using navigation buttons }
Can't reproduce in gist because it involves navigation using back and forward.
I make a check for unsaved data in a form and prompt the users if they really want to leave if there are any. If they hit "cancel" they should be prompted again if they try to navigate away again until they either save the data or click "ok" in the prompt.
The text was updated successfully, but these errors were encountered: