feat: [#5777] Add navigation buttons for steps in case contact form
What github issue is this PR for, if any?
Resolves #5777
👀 - This is my first contribution to this codebase, I am happy to make updates/change requests or discuss why I made certain decisions
❓ Open questions for a future PR:
- "back" from the first step
- CURRENT BEHAVIOR: disabled
- Are you allowed to do this or should it be disabled?
- If yes, should it align with the expected validation behavior as the "Back" button at bottom of form?
- "forward" from last step
- CURRENT BEHAVIOR: disabled
- Are you allowed to do this or should it be disabled?
- If you are allowed to "step forward", then would this just act as a secondary "submit" button?
- Noticed a small style discrepancy that is out of scope for this work, but figured I should document - the dropdown is missing the padding on the right that other dropdowns have on this form
- Noticed a possible bug with validation on the field "select all contact types"
- If you validate step 1 (details) successfully, but then go back and remove the field value, you can still validate successfully. I wonder if it is catching an empty array/list or something because it's multiselect within the dropdown (design question: why isn't this just a required checkbox set... why a dropdown at all?)
What changed, and why?
- Added step buttons according to issue details (similar to carousel design and to the left of the phrase "step n of x"
- 🐛 Fixed a bug where after validation errors, the progress and step portion of the title disappeared because we didn't persist the data from #update
- Handles validation/saving between pages when using step buttons (excluding details outlined in "Questions for a future PR" above)
How is this tested? (please write tests!) 💖💪
Note: if you see a flake in your test build in github actions, please post in slack #casa "Flaky test: " :) 💪 Note: We love capybara tests! If you are writing both haml/js and ruby, please try to test your work with tests at every level including system tests like https://github.com/rubyforgood/casa/tree/main/spec/system
- Added a new spec for the new step button component
spec/components/form/step_navigation_component_spec.rb
Screenshots please :)
Run your local server and take a screenshot of your work! Try to include the URL of the page as well as the contents of the page.
Feelings gif (optional)
What gif best describes your feeling working on this issue? https://giphy.com/
How to embed:
* "back" from the first step * CURRENT BEHAVIOR: disabled * Are you allowed to do this or should it be disabled? * If yes, should it align with the expected validation behavior as the "Back" button at bottom of form?
Disabled makes sense.
* "forward" from last step * CURRENT BEHAVIOR: disabled * Are you allowed to do this or should it be disabled? * If you are allowed to "step forward", then would this just act as a secondary "submit" button?
Disabled makes sense.
* Noticed a small style discrepancy that is out of scope for this work, but figured I should document - the dropdown is missing the padding on the right that other dropdowns have on this form 
Good call. Feel free to open an issue :slightly_smiling_face:
* Noticed a possible bug with validation on the field "select all contact types" * If you validate step 1 (details) successfully, but then go back and remove the field value, you can still validate successfully. I wonder if it is catching an empty array/list or something because it's multiselect within the dropdown (design question: why isn't this just a required checkbox set... why a dropdown at all?)
Good catch. I make a note and open an issue later. Or you can if you would like. And for context the previous design was multiple checkboxes but we got some feedback that there are too many (20+) in some orgs.
Haven't looked to close at the code yet but briefly testing it I seem to be able to proceed forward from the first page via arrow buttons and it ignores validations.
That is I can proceed via arrow key but not submit button.
@elasticspoon
- I will remove gemfile.lock change
- I will make the
slotupdate - I will start looking into the conditional bug for validation and submit... I tested that exact case so I will need a second to dig in (#whydoesitworkonmine 😆)
@elasticspoon
- ✅ I will remove gemfile.lock change
- ✅ I will make the slot update
- ❌ I will start looking into the conditional bug for validation and submit... I tested that exact case so I will need a second to dig in (#whydoesitworkonmine 😆)
- I am unable to recreate "failed to validate on nav button" so I am still digging in here to figure it out why your local was able to click forward and avoid validation but mine catches validation. I'm going to try other test users and dig in further into the current forms code to see if I can spot why this behavior would have hit the exception for validation instead of the default of assuming validate on wizard movement
- Do you mind confirming again if this behavior is still live on this branch? Which dev/test user are you using?
- ❌ New spec failures are due to the slot change and updating the spec to reflect this new behavior - working on this update as well
This PR has been open for a long time without any pushes or comments! What's up?
No longer applicable after #6048 ?
This PR has been open for a long time without any pushes or comments! What's up?
Any news here? It looks pretty stale sadly. Closing for now. Please feel free to reopen!!