CDCgov / prime-simplereport

SimpleReport is a fast, free, and easy way for COVID-19 testing facilities to report results to public health departments.
https://simplereport.gov
Creative Commons Zero v1.0 Universal
58 stars 53 forks source link

Re-examine the use of Prompt on forms #4534

Open emmastephenson opened 2 years ago

emmastephenson commented 2 years ago

Background

We use the Prompt component on several forms to ask users if they want to navigate away from a form with unsaved changes. This Prompt was removed in the latest version of react-router, so in order to upgrade we have to either implement a workaround or change the design.

Action requested

A design consultation is requested to see if we want to continue using the Prompt pattern, or if we'd rather move towards quietly storing the data locally so the user can come back to it. (See #4508 for a further discussion of the options)

Acceptance Criteria

A decision has been made to either remove the Prompt pattern, or to work around it for the upgrade. A ticket has been made for engineering followup to implement the chosen solution.

Additional context

See #4508 for more discussion and details.

emmastephenson commented 2 years ago

This is an example of the prompt: Screen Shot 2022-10-25 at 10.51.11 AM.png

kenieh commented 2 years ago

@emmastephenson when are we planning to upgrade the react-router?

Also, the design team discussed this and we believe auto-saving the input fields isn't a common design pattern for form designs. We believe that we should implement an existing SR modal (see screenshot example from Conduct Test) to ask users this prompt—this is a common design pattern we've seen in form design.

Screen Shot 2022-10-27 at 10.31.49 AM.png

emmastephenson commented 2 years ago

@kenieh good to know, thanks! We don't have a scheduled time to upgrade react-router yet. I think we'll need to upgrade it whenever we move to the new version of React though.

emmastephenson commented 2 years ago

It looks like the React Router team is considering re-enabling Prompt in v6: https://github.com/remix-run/react-router/issues/8139#issuecomment-1314593566

We should check back on that thread before picking up this ticket.

emmastephenson commented 1 year ago

Note that this was not required for the recent React upgrade! So this will only need to be done once we want to upgrade react-router.