department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
281 stars 196 forks source link

Save-in-progress dynamic messages #14726

Open Mottie opened 3 years ago

Mottie commented 3 years ago

User story(ies)

As a form 526 user, I need/want to unsure that the save-in-progress messaging matches the page title, so that a Benefits Delivery at Discharge (BDD) user knows that the save-in-progress data is specific to the BDD form flow and not the original/all-claims flow that form 526 could also be following. This is especially important for users that use screenreaders.

Additional details/notes/links

The title of the form is set using the formConfig title. It is passed the formData and uses a helper function to determine if the user is in a BDD vs original/all-claims flow.

title: ({ formData }) => getPageTitle(formData);

This request is to allow passing a function into the new saveInProgress messages in the form config - see https://github.com/department-of-veterans-affairs/vets-website/pull/14468/files#r502724725.

For example:

saveInProgress: {
  messages: {
    inProgress: ({ formData }) => `Your ${getPageTitle(formData)} ... is in progress.`.
    expired: ({ formData }) => `Your saved ${getPageTitle(formData)} ... has expired...`,
    saved: ({ formData }) => `Your ${getPageTitle(formData)} ... has been saved.`,
  },
},

Acceptance criteria

Allow dynamic updating of the save-in-progress messaging based on the form flow.

Point(s) of contact

@Mottie

What type of issue is this?

How to configure this issue

cvalarida commented 3 years ago

I looked into this one earlier today and it seems like a reasonable addition to the forms library. The only thing I'd be concerned about is in the profile page. Currently, the profile code and forms description isn't tied tightly tied to the formConfig, but I imagine it will be later. (cc @erikphansen, I believe?) If that's the directly we want to go, I think we can't pass the formData to that function because we'd need to get all the saved data for all the forms before we could render any of the titles. That's not a thing we want to do.

Potentially, though, that's a thing for your team and the profile team to work out.

Mottie commented 3 years ago

If the formData isn't available, then the message falls back to the default value, disability compensation in this case.

cvalarida commented 3 years ago

Who would be the best content SME to ask about this? Peggy? It seems like we might be able to always use disability compensation. I'm not sure I fully understand what the benefit is of changing the form title. Especially given the complexity and coupling it'll introduce.

Mottie commented 3 years ago

Yes, Peggy would be the person to contact.