router back preventDefault on Firefox not working properly

6 posts, 0 answers
  1. Marcin
    Marcin avatar
    195 posts
    Member since:
    Jan 2011

    Posted 01 Feb 2019 Link to this post

    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.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2188 posts

    Posted 05 Feb 2019 Link to this post

    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
    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.
  3. Marcin
    Marcin avatar
    195 posts
    Member since:
    Jan 2011

    Posted 06 Feb 2019 in reply to Ivan Danchev Link to this post

    Hello

    I'm using pushState: true

    If you set this, back is not prevented

    http://dojo.telerik.com/AVaBuGAd/8

  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2188 posts

    Posted 08 Feb 2019 Link to this post

    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
    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.
  5. Marcin
    Marcin avatar
    195 posts
    Member since:
    Jan 2011

    Posted 08 Feb 2019 in reply to Ivan Danchev Link to this post

    In console I'm seeing change event fired and route event fired on back press even if is prevented.
  6. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2188 posts

    Posted 12 Feb 2019 Link to this post

    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
    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.
Back to Top