Closed wesrowe closed 2 years ago
Goal: assess & propose API calls next steps, specifically.
The spike details recommendations for each goal below, and are summarized here for convenience:
Code reuse options are currently limited due to how the two page types’ "components" are built. The detail page leverages bespoke javascript via a javascript widget injected into the detail pages. The widget adds a click handler for each download link in the DOM.
The search page uses a set of react components driven by state produced by the forms data retrieved during content release.
Moving the modal to a single, reusable component shared amongst both page types will drastically reduce modal-related technical debt, and provide optimal code reuse.
Move to a single react component for both page types. This would be a bit of a refactor for the detail pages and the respective liquid template structure. However, this presents the best approach to reuse and technical debt. (this concept needs FE review)
Lift: Medium to Large
The UX presents several challenges in current form:
Runtime form validations exist for detail pages. Both of them require network requests and they can prevent downloading a valid PDF, depending on responses. As currently written the validations occur without UI updates, and can delay the download for as long as the network request elapses. Having experienced Forms API degradation and outages recently brought the previously unknown issue to the surface. This issue is imperceptible on quality broadband internet connections during low latency Forms API performance, but reveals itself quickly if either of these is degraded.
The modals used for PDF guidance between page types have an inconsistent design. The search page modal uses a download link whereas the detail page uses a download button. The detail page design is the preferred design.
The cookie prevents firing of the PDF helper modal consistently. The modals, despite being unique components on both page types, only display once per 24 hours.
Form validations present challenging UX scenarios to solve for, and cause additional network traffic on the client side. As such, it is recommended to remove these ‘runtime’ form validations should they not be determined as required. However, if that is not possible, validation recommendations are presented below.
The first recommendation is to consolidate to a single form validation method, using the “HEAD prefetch” method. This method is a lightweight client-side callback that retrieves the HTTP headers from a request for the filename–meaning that the file itself isn’t downloaded, but just enough information to know if the file would be delivered if a download was attempted. However, due to current CORS limitations, this method is only capable of firing for PDFs hosted by va.gov. To overcome this, the va.gov domain needs to be added to the HTTP response Access-Control-Allow-Origin header property. So the bulk of the work to achieve 100% coverage with this validation will be in working with forms admins and their developer/IT resources.
The validation should would be non-blocking (any failure or delay will not prevent the user from attempting to download the file), and provide UI feedback. This would likely require rearchitecting the validation code to suit these requirements. UX research and design may be necessary to realize a quality experience that also produces the necessary validation.
Consolidate both modals into one component. The design from the detail page (the one with the download button) should be used. #10850 Remove the cookie logic, and instead always toggle the modal immediately. - #10524
Lift: Large
If runtime form validation is NOT required: Consider removing sentry logging calls, as were used for flagging runtime errors, and therefore no longer relevant. - #10235
Maintain existing GA analytics event triggers with opening/closing of the modal and link click events.
If runtime form validate IS required: consolidate sentry logging to reflect changes to validations from above, whereby we remove all but one validation. This will allow for more directed information to the user and for our analysis purposes. - #10236
Tickets created: https://github.com/department-of-veterans-affairs/va.gov-cms/issues/10524 https://github.com/department-of-veterans-affairs/va.gov-cms/issues/10235 https://github.com/department-of-veterans-affairs/va.gov-cms/issues/10236 https://github.com/department-of-veterans-affairs/va.gov-cms/issues/10850 https://github.com/department-of-veterans-affairs/va.gov-cms/issues/10851
@dsasser My questions:
Re: determining whether we're allowed to remove the runtime events: the most efficient way to work that out will be to identify the code that implements the check, git blame, and find the tickets, and review who the decider was at the time/factors that went into it. If you can point me to the code in question, I can chase the paper trail.
I went through your comment and added the ticket links for the work described, to make sure we're clear on the tradeoffs / if-thens. Take a look and make sure I connected the dots correctly?
I do think the meeting to review would be helpful.
... and findings sound like we would go ahead with both if we're allowed. Just confirming that's true?
Correct, the recommendation is to go ahead and remove both the API and HEAD fetch calls, if allowed.
...whether we're allowed to remove the runtime events: the most efficient way to work that out will be to identify the code that implements the check, git blame, and find the tickets
This commit introduced the PDF Download Guidance logic for the Form detail pages which includes both API and HEAD calls on download click. And here is the related PR.
I went through your comment and added the ticket links for the work described, to make sure we're clear on the tradeoffs / if-thens. Take a look and make sure I connected the dots correctly
The links look correct to me, thanks for doing that.
From discussion with Dave/Wes today:
Description
As a Veteran, I want to have the same experience downloading a PDF regardless of whether I'm on the Form Search or Form Detail page so that I trust the experience.
As a Find-a-form maintainer, I want the code to be the same for downloading a PDF across the Form Search and Form Detail pages so that it's simpler to maintain high quality.
Background
In #10509 we discovered that code (all in vets-website) is very different across Form Search and Form Detail pages when the user clicks a "Download PDF" link. The two flows are documented in this Mural.
Key differences:
We want to re-use the same code such that a download click on either page type (Search or Detail) leverages the same JS and UI code, thus delivering an identical experience to Veterans.
Things to identify the better version of:
Another Key question – Error Alerts There is currently an Alert UI component that sometimes displays when a download fails (the one with a mailto link for Forms Mgr).
Acceptance Criteria
CMS Team
Please check the team(s) that will do this work.
Program
Platform CMS Team
Sitewide Crew
⭐️ Sitewide CMS
⭐️ Public Websites
⭐️ Facilities
⭐️ User support