The "Unsaved changes" modal is currently shown when leaving the page (for example click another navigation item) with unsaved changes.
This dialog should also be shown when a user clicks Cancel with unsaved changes, to prevent losing changes when the Cancel button is accidentally clicked.
screenshot-2 shows the dialog which is shown when you click another naviation item. screenshot-3 shows the Cancel button. The dialog is currently not shown when clicking Cancel, this should be changed.