Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save changes popup #1859

Merged
merged 29 commits into from
Jun 22, 2023
Merged

Save changes popup #1859

merged 29 commits into from
Jun 22, 2023

Conversation

TheSlimvReal
Copy link
Collaborator

@TheSlimvReal TheSlimvReal commented Apr 26, 2023

see issue: #1424

Visible/Frontend Changes

  • User confirmation for closing edited popups
  • User confirmation when navigation from edited from details

Architectural/Backend Changes

--

@github-actions
Copy link

Deployed to https://pr-1859.aam-digital.net/

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a usability perspective:

  • confirmation shows while in the background navigation is already done. This seems uncommon for such a workflow, feels slightly off (dialog refers to previous view) and it may be useful for a user to still see the changes to save/discard.
  • Navigating to Children list and confirming to save changes, the list does not get updated with the newly saved change (e.g. name is still the old one until reloading that view) (not applicable anymore, as navigation only when discarding)
  • Should we ask for confirmation also when clicking "Cancel" instead of "Save" in the Form? (We do that on "Cancel" in the popup forms already)
  • Popup form "Save" button still asks whether I want to save changes. That shouldn't be necessary.
  • Cancel (in addition to saving yes/no) would be a useful further option to go back to editing. Half the time I get such a message in other software I end up doing some further editing. (Could be moved to a separate PR/issue if we want this out quickly)
  • some websites prevent you to navigate away even to a completely different domain in the browser if you have unsaved changes. This could be useful here as well. Currently I can navigate or reload to lose changes and the confirmation only happens for internal app navigation

@TheSlimvReal
Copy link
Collaborator Author

@sleidig I have now implemented the logic in a way that it shows the form popup before navigation is done.

With this approach there are still some open questions:

  • What do we do with different panels (we could deactivate the other panels while one is in edit mode)?
  • When do we want to show the popup? At the moment it only occurs on navigation and when clicking the backdrop of a popup. Further options would also include "Cancel" and the "X" button in a popup.

Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good improvements! :-)

What do we do with different panels (we could deactivate the other panels while one is in edit mode)?

More comfortable would be if we can consider switching tabs the same as switching pages and show the dialog instead of preventing the switch per se. Technically difficult?

When do we want to show the popup? At the moment it only occurs on navigation and when clicking the backdrop of a popup. Further options would also include "Cancel" and the "X" button in a popup.

Slightly unsure here. What do you think? Tending a bit towards showing it on cancel, too.


Recently read a design book that highlighted how the safeguard ("Do you want to save changes?") can become the most easy, default way to save a document for some users. In that regard, showing the dialog (and maybe considering to extend it with even more explicit buttons) could be worth considering.
Screenshot from 2023-05-09 09-48-52

@TheSlimvReal
Copy link
Collaborator Author

The features that have not been implemented yet are very difficult to achieve:

Restrict panel navigation with unsaved changes

It is not possible to keep the panel activated but still disable the navigation to another panel. We can either disable the panel completely or only show a popup after the navigation has happened. In the later case it's still difficult to implement the "leave/cancel" functionality as this would need to be communicated back to the form component (at the moment it would just stay in edit mode).

Having a save button in the popup

This has the same problem as mentioned before that the "save" trigger needs to be forwarded to the underlying component which is quite difficult to achieve with our setup.

@TheSlimvReal TheSlimvReal requested a review from sleidig May 30, 2023 06:23
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested:

details view (in edit mode with changes):

  • navigate -> confirmation | yes -> navigating and discarding changes
  • navigate -> confirmation | no -> remain on view in edit mode
  • [edit mode without changes] -> navigate -> no confirmation dialog
  • close browser / leave app -> browser confirmation | cancel -> remain on view in edit mode
  • switch tab -> ❓ no confirmation -> navigate -> :warn: confirmation (about unfocused tab)
    -> I agree with your suggestion and thinking about would now vote for disabling tab switches while in edit mode. This would also be consistent with our UX when creating a new entity (and we can maybe use the same code).

popup form (with changes):

  • backdrop click -> confirmation | no -> remain on popup with changes
  • backdrop click -> confirmation | yes -> closing popup, discarding changes (:rotating_light: changes are currently saved anyway)
  • cancel click -> no confirmation
    ⚠️ I would've expected that cancel and backdrop have the same behavior but it also makes sense to not additionally ask on cancel (and that is consistent with the details view behavior) ✔️
  • [without changes] -> cancel/backdrop -> no confirmation dialog
  • close browser / leave app -> browser confirmation | cancel -> remain on view in edit mode
    ⚠️ not sure whether technically not possible but for UX + consistency it would be great to prevent browser close in this case as well

# Conflicts:
#	src/app/core/form-dialog/dialog-buttons/dialog-buttons.component.spec.ts
@TheSlimvReal TheSlimvReal requested a review from sleidig June 20, 2023 14:56
Copy link
Member

@sleidig sleidig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the code clarifications! 🙏 Looks excellent now.

I re-tested and updated the checklist above: #1859 (review)

Good to go for me.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@TheSlimvReal TheSlimvReal merged commit a689b02 into master Jun 22, 2023
@TheSlimvReal TheSlimvReal deleted the save_changes_popup branch June 22, 2023 08:32
@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.22.0-master.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@aam-digital-ci
Copy link
Collaborator

🎉 This PR is included in version 3.22.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants