Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 1st pass issues with bill & bill licence pages (#511)
https://eaflood.atlassian.net/browse/WATER-4155 https://eaflood.atlassian.net/browse/WATER-4156 After a first pass of the new view bill and bill-licence pages we've built some issues have been spotted. This change resolves *** Broken screen reader text in 'View transactions link'** We overlooked updating the context property being referenced in a refactor. *** Fix undefined in view bill licence We were only setting, for example, the `additionalChargesDetail` variable in the template if there were additional charges. But we were then referencing `additionalChargesDetail` when setting `detailChargeInfo`. ```nunjucks {% set detailChargeInfo = detailChargeInfo + additionalChargesDetail + adjustmentsDetail + '</p>' + elementDetail %} ``` This is why the template was showing `undefinedundefined` when a transaction had no additional charges or adjustments. By flipping the logic, i.e. always instantiating a variable but only populating it when something exists we avoid Nunjucks thinking `additionalChargesDetail` or `adjustmentsDetail` are ever undefined. *** Use set address for view bill backlink The initial requirement for the story was that however a user came to the view bill page the backlink should take them to where they came from. This could be 1 of 3 places - bill run summary - billing account summary - billing account all bills When you first come to the view bill page we use [referrer](#486) to generate the backlink. At this point we can get you back to where you came from. But that list is incomplete with the addition of the view bill-licence page (see WATER-4156 ). So, you come to the view bill page, then click through to the view bill-licence page and then go back, now `referrer` is the view bill-licence. This results in the user being stuck in a loop. ``` [source] --> [view bill ] --> [view bill-licence] --> [view bill ] [back = source] [back = view bill ] [back = view bill-licence] ``` Having discussed this with our designer, it was agreed having the backlink attempt to recreate what the back button does is a type of anti-pattern. Backlinks we build into the pages should help a user navigate through a _planned_ journey. Essentially, if you come from, for example, billing account summary, you have jumped from the licence summary journey to the bill runs journey. As such when you go back, you should go back through the bill runs journey. *** Better backlink text Following on from our decision to always have backlinks take you to a specific point in a _planned_ journey we also agreed we'd make it clearer where the backlink will take you in the UI. We're using the [advice in the design system for back links](https://design-system.service.gov.uk/components/back-link/) to use different link text. > For more complex user journeys, consider using different link text, like ‘Go back to [page]’. For example, in an admin system with many different areas. In this case, if you used ‘Back’, it might not be clear to users what they are going back to. We've applied this advice to both the view bill and view bill-licence pages.
- Loading branch information