-
Notifications
You must be signed in to change notification settings - Fork 221
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
(fix) Show discard changes confirmation modal only when fields get touched #1323
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size Change: -5.84 kB (-0.1%) Total Size: 6.09 MB ℹ️ View Unchanged
|
denniskigen
requested review from
vasharma05,
jayasanka-sack,
ibacher and
NethmiRodrigo
September 23, 2024 08:13
denniskigen
changed the title
(fix) Show discard changes confirmation modal when fields get touched
(fix) Show discard changes confirmation modal only when fields get touched
Sep 23, 2024
This PR tweaks the logic for showing the discard changes confirmation modal in the patient registration form. Previously, the modal was being shown in cases where the user had not made any changes. Now, the modal will only be shown when the user has made changes and attempts to navigate away from the form. This is done by checking whether any of the form fields have been [touched](https://formik.org/docs/api/formik#touched--field-string-boolean-). This aligns with the expected behavior of the form and provides a better user experience. Also, this PR refactors the `DeleteIdentifierConfirmationModal` to leverage Carbon's ModalHeader, ModalBody, and ModalFooter components. It also refactors its registration in the `routes.json` file so it leverages the `modal` property of the route definition. This aligns with our best practices for registering modals.
denniskigen
force-pushed
the
fix/registration-form-touched-fields
branch
from
September 23, 2024 22:01
04b3225
to
1efe5e2
Compare
ibacher
approved these changes
Sep 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
Summary
This PR tweaks the logic that determines when to show the Patient Registration form discard changes confirmation modal. Presently, the modal is shown when the user discards the form without making any changes. This PR changes the logic to show the modal only when the user has made changes that would be lost if they navigate away from the form without saving. This is done by checking whether any of the form fields have been touched. This aligns with best practice where the user is prompted only when they've made changes to the form.
Another tweak in this PR involves refactoring
DeleteIdentifierConfirmationModal
to leverage Carbon'sModalHeader
,ModalBody
, andModalFooter
components. It also refactors its registration in theroutes.json
file so it leverages themodal
property of the route definition. This aligns with our best practices for registering modals.Screenshots
expected.mp4
Related Issue
Other