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

Resolve issue with autocomplete pre-filling back link #188

Merged

Conversation

JamieCleare2525
Copy link
Contributor

@JamieCleare2525 JamieCleare2525 commented Jan 31, 2024

Context

Back links on the Provider and School onboarding (Claims and Placements) "Check your answers" pages need to redirect back to the "New" onboarding forms, with the user's selection pre-filled.
Once directed back, and the form is pre-filled, clicking continue should submit the form and take the user back to the "Check your answers" page.

Developer Insight

Due to an issue with the accessible-autocomplete, additional javascript and changes to how options are rendered needed to be added to app/javascript/controllers/autocomplete_controller.js. Otherwise, the result of using defaultValue results in an undefined option appearing in the dropdown.
See alphagov/accessible-autocomplete#424 for more details.

Changes proposed in this pull request

  • Back links on the "Check your answers" pages for Schools and Providers (Claims and Placements) redirect back to the "New" onboarding forms, with pre-filled user input (School or Provider name).
  • PreviousSearch tag added to html, to allow stimulus to assign the Provider/School name and id to the correct inputs.
  • Methods added to Provider/School Onboarding Form classes to easily assign back params.

Guidance to review

  • Follow steps to onboard to a school/provider until you reach the "Check your answers" page.
  • Once on the "Check your answers" page, Click the "back" link at the top of the page.
  • You should be redirected back to the "New" onboarding form for the school/provider.
  • The user input for the "New" onboarding form should be pre-filled with the school/provider name.
  • Clicking "Continue", without searching should return the user to the "Check your answers" page for the same school/provider.

Link to Trello card

https://trello.com/c/e5SwYKuK/138-fix-back-links-on-providers-schools-onboarding-pages-to-pre-fill-the-search-input-new-page-with-users-input

Screenshots

Screen.Recording.2024-01-31.at.16.21.18.mov

@JamieCleare2525 JamieCleare2525 added the deploy A Review App will be created for PRs with this label label Jan 31, 2024
@JamieCleare2525 JamieCleare2525 self-assigned this Jan 31, 2024
@JamieCleare2525 JamieCleare2525 requested review from a team as code owners January 31, 2024 16:22
Copy link

github-actions bot commented Jan 31, 2024

Review app track and pay deployed to https://track-and-pay-188.test.teacherservices.cloud was deleted
Review app school placements deployed to https://manage-school-placements-188.test.teacherservices.cloud was deleted

Copy link
Contributor

@elceebee elceebee left a comment

Choose a reason for hiding this comment

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

I think this looks great. I found one little edge case, see video. If you clear the field and then click continue (without entering new data), the old data is persisted.

Honestly, unless it's a really easy fix, I don't think it's really worth doing.

And I'm perfectly happy with that little sliver of an empty drop-down -- better than [undefined undefined]. We are working with a far-from-perfect component here, so this might be the bets we can do for now.
https://github.com/DFE-Digital/itt-mentor-services/assets/44073106/a24e6200-d1ea-4201-a71f-302de0222db8

Copy link
Contributor

@CatalinVoineag CatalinVoineag left a comment

Choose a reason for hiding this comment

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

Great effort! The autocomplete is a pain to work with

@JamieCleare2525 JamieCleare2525 force-pushed the jc/onboarding_back_links_autofill_provider_schools branch from 7cb1f46 to 02f87d3 Compare February 1, 2024 09:46
@JamieCleare2525 JamieCleare2525 merged commit 1eaaccf into main Feb 1, 2024
6 checks passed
@JamieCleare2525 JamieCleare2525 deleted the jc/onboarding_back_links_autofill_provider_schools branch February 1, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants