PaulNieuwelaar / alertjs

Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
https://www.magnetismsolutions.com/our-products/alertjs-alert-popup-for-d365
Other
96 stars 38 forks source link

Browser back/forward buttons failing to remove Modal #11

Closed rahulkr95 closed 6 years ago

rahulkr95 commented 6 years ago

Hi Paul,

I am using AlertJs in the form pages based on certain label onClicks. It works perfectly on the page. It prevents user interaction on the page and forces users to use the custom buttons that have been set up to continue their actions. But recently out of chance I pressed the browser back button on the form page after the Modal loaded, the back action happened, it went to the previous page but failed to remove the modal.

Scenario -

  1. Open AlertJS modal
  2. Use Browser Back or Front Buttons
  3. Back/Front action takes place but AlertJS modal fails to close.

Is this an expected behaviour or a bug ? Or is it part of some settings provided in the documentation?

PaulNieuwelaar commented 6 years ago

Hi, this is a known issue. Unfortunately there's not a lot we can do to prevent this happening, as CRM handles the back button weirdly (it doesn't actually reload the page). Since the alert wrapper sits outside the form, it stays with the page if you navigate using back/forward. After leaving the page, the button events on the alert will not fire, but you should still be able to close the alert using the "X" in the corner of the alert. Sorry for any inconvenience, Paul

rahulkr95 commented 6 years ago

Thank you for the prompt reply.

I figured that was the reason but just wanted to verify it. Your solution is an excellent way to get custom modals and helps open up more avenues of user experience. Thank you.

I should be able to do a hide on click or change of history.hash or some sort. I'll work on that.