onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

Notification of unsaved changes #697

Closed fredericalpers closed 2 months ago

fredericalpers commented 7 months ago

Initiative

Optimize the backend of the onOffice for WP-Websites Plugin for a better user experience

Epic

Notification of unsaved changes.

User story

As a real estate agent utilizing the onOffice for WP-Websites plugin, I often make configurations and adjustments in the settings to optimize my website. Currently, there is no notification system in place to alert me when I attempt to leave a settings page without saving changes. To prevent loss of modifications, I propose the implementation of a notification system that provides a clear alert when unsaved changes have been detected.

The absence of notifications for unsaved changes poses a risk of unintentional settings/data loss and can result in time-consuming reconfigurations. To address this concern, a notification system should be integrated into the onOffice for WP-Websites Plugin, ensuring that users are reminded to save their changes before navigating away from the page.

Tasks

By implementing this notification system, the onOffice for WP-Websites Plugin can enhance the user experience by minimizing the risk of unintended data loss and promoting a more user-centric approach to configuration changes.

Related links: https://cloudscape.design/patterns/general/unsaved-changes/ https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

changes-not-saved-yet (4)

dai-eastgate commented 7 months ago

@fredericalpers I have found a solution and I need 3 days to implement and test it. Thanks!

dai-eastgate commented 6 months ago

@fredericalpers I implemented the "Notification of unsaved changes" with the following screens: Addresses, List View, Detail View, Similar Estate, Unit List, Contact form, Interest form, Applicant Search Form, Owner form, and Settings. Please take a look at my video and let me know your opinions. Thanks!

https://files.fm/u/jgeruf6j6g#/view/wxuxy38eh8

Note: During testing, I found that the "beforeunload" event will not support the user behavior of "entering URL".

https://files.fm/u/jgeruf6j6g#/view/k85e593vhj Is this too big a problem for you? Can we ignore it or not? If you need me to fix it, I will investigate it and give you feedback on the research results.

fredericalpers commented 6 months ago

@dai-eastgate please investigate further thank you :)

dai-eastgate commented 6 months ago

@fredericalpers After investigating, I have the following observations:

  1. The document (https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) mentions an issue: "The main use case for this event is to trigger a browser-generated confirmation dialog that asks users to confirm if they really want to leave the page when they try to close or reload it, or navigate somewhere else. This is intended to help prevent loss of unsaved data."

=> When we use "beforeunload_event" and calling the event object's preventDefault() method, we can trigger a browser-generated confirmation dialog (meant: Showing the browser-native confirmation modal) to handle the "cancel" button to show the "Notification of unsaved changes"

  1. According to the document ("https://cloudscape.design/patterns/general/unsaved-changes/) With the following 5 user behaviors: image

Above are the results of my investigation. You can check it out and let me know your opinions. Thanks!

fredericalpers commented 6 months ago

@dai-eastgate please go ahead and implement all possible notifications. :)

dai-eastgate commented 5 months ago

@dai-eastgate please go ahead and implement all possible notifications. :)

We created a PR for this issue. Please help us to review it. Thanks!