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

feat: add modal prop to force modal interaction; #1085

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

apattersonATX-HB
Copy link
Contributor

@apattersonATX-HB apattersonATX-HB commented Nov 6, 2024

Orchestration has been asked to combine the dynamic schedule draft mode with the standard view. The draft pages were built as individual routes using a shared store to pass task changes between them. In combining these pages, we need to warn users their changes will be lost before allowing them to navigate away. Since we're using a shared store and not just a shared form I want to update Blueprints <NavigationContext /> navigationCheckCallbacks to support more robust nav checks. I've gotten that working, but since the inner <NavigationPrompt /> from react-router-navigation-prompt passes its own callback when a cancel action happens, routing breaks if a user clicks outside of our modal or closes with the x icon since the NavigationPrompt inner onCancel callback is never called.

Context (branch is WIP):

TLDR: Needed a way to force users to interact with the modal.

Screen.Recording.2024-11-06.at.11.39.31.AM.mov

* Relies on you to provide a way to close the modal, i.e. a cancel or confirm button.
* Useful if you definitely need to force the user to make a choice.
* */
forceModalInteraction?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Thought: I think my first guess at naming this would have been allowClosing (defaults true, users can set it to false)... Maybe still a slight preference for that, but not totally against forceModalInteraction; wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Names are hard, and i cant come up with anything better 🙃 Will update to allowClosing

@apattersonATX-HB apattersonATX-HB merged commit 3d6617f into main Nov 6, 2024
6 checks passed
@apattersonATX-HB apattersonATX-HB deleted the sc-60329/modal-force-modal-interaction branch November 6, 2024 18:54
homebound-team-bot pushed a commit that referenced this pull request Nov 6, 2024
## [2.370.0](v2.369.7...v2.370.0) (2024-11-06)

### Features

* add modal prop to force modal interaction; ([#1085](#1085)) ([3d6617f](3d6617f)), closes [/github.com/homebound-team/internal-frontend/compare/main...sc-60329/schedules-merge-draft-view#diff-3e5dd94f92d2a5b4d5e1e0b362d7d8e2d9ec52af58eb9cfd833a0e195d56ed3](https://github.com/homebound-team//github.com/homebound-team/internal-frontend/compare/main...sc-60329/schedules-merge-draft-view/issues/diff-3e5dd94f92d2a5b4d5e1e0b362d7d8e2d9ec52af58eb9cfd833a0e195d56ed3) [/github.com/homebound-team/internal-frontend/compare/main...sc-60329/schedules-merge-draft-view#diff-832d5b6b2b80a4d541fbe0eb1a55eaf856777b136a6f2e4540880035f544be87R82](https://github.com/homebound-team//github.com/homebound-team/internal-frontend/compare/main...sc-60329/schedules-merge-draft-view/issues/diff-832d5b6b2b80a4d541fbe0eb1a55eaf856777b136a6f2e4540880035f544be87R82)
@homebound-team-bot
Copy link

🎉 This PR is included in version 2.370.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants