I'm trying to prevent back on firefox by preventing event.
It is not working properly. Page stays where it was, but change event is still fired and page is still rerouted behind to the same one.
It cause loosing whole page state. because even if url stays the same page was reloaded.
5 Answers, 1 is accepted
0
Hello Marcin,
I checked whether preventing the Router's back event leads to the change event being fired in Firefox, but was not able to reproduce this behavior. Here's a dojo example, in which the event is prevented. As you can see in this screencast the change event fires when you navigate to the Detail view, but on clicking "back" the back event is prevented and the change event does not fire. Could you modify the example accordingly so that it demonstrates the problematic Firefox behavior and link it back for further review?
Regards,
Ivan Danchev
Progress Telerik
I checked whether preventing the Router's back event leads to the change event being fired in Firefox, but was not able to reproduce this behavior. Here's a dojo example, in which the event is prevented. As you can see in this screencast the change event fires when you navigate to the Detail view, but on clicking "back" the back event is prevented and the change event does not fire. Could you modify the example accordingly so that it demonstrates the problematic Firefox behavior and link it back for further review?
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0

Marcin
Top achievements
Rank 1
Veteran
answered on 06 Feb 2019, 10:20 AM
Hello
I'm using pushState: true
If you set this, back is not prevented
0
Hello Marcin,
I checked the behavior in the modified example you posted and from what I can see the back event is prevented even with pushState: true. Note that when the back event is prevented the previous URL is restored (back event documentation: "Calling the preventDefault method of the event object will stop the change and restore the previous URL."). This is what happens in the dojo as well. See the following screencast which shows the url remaining the same (detail) when the back event is prevented and changing to "result" when the event is not prevented. As for the change event firing with pushState enabled, it fires in Firefox, Edge and Chrome so it is not a Firefox-specific behavior.
Regards,
Ivan Danchev
Progress Telerik
I checked the behavior in the modified example you posted and from what I can see the back event is prevented even with pushState: true. Note that when the back event is prevented the previous URL is restored (back event documentation: "Calling the preventDefault method of the event object will stop the change and restore the previous URL."). This is what happens in the dojo as well. See the following screencast which shows the url remaining the same (detail) when the back event is prevented and changing to "result" when the event is not prevented. As for the change event firing with pushState enabled, it fires in Firefox, Edge and Chrome so it is not a Firefox-specific behavior.
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0

Marcin
Top achievements
Rank 1
Veteran
answered on 08 Feb 2019, 11:40 AM
In console I'm seeing change event fired and route event fired on back press even if is prevented.
0
Hello Marcin,
We logged the issue with the change event firing after the back event has been prevented for fixing. You can track its progress through this Github item.
I updated your Telerik points for reporting this bug.
Regards,
Ivan Danchev
Progress Telerik
We logged the issue with the change event firing after the back event has been prevented for fixing. You can track its progress through this Github item.
I updated your Telerik points for reporting this bug.
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.