-
Notifications
You must be signed in to change notification settings - Fork 236
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
Use JavaScript for back links #494
Comments
Just double-checking you mean just for prototyping - rather than for the back-link component in GOV.UK Frontend? |
Yeah I meant just for prototyping, but you raise a good point, another example of where production and prototyping needs might be different. Maybe the kit can consume the back link, and add the JavaScript to it in the template question page |
We should consider if the JavaScript should be used in production too. |
Agreed, given that the browser back button should work as advertised anyway. $$ question: What kind of 'back' is the right one? Is it whatever the previous page was, or some predetermined URL? Example: You go back to question 5 from the 'Check your answers' page. Does the back link: a) take you to the 'Check your answer' page |
I think it's the check your answers page, but probably some research would help. But I think the previous browser page (JavaScript history -1) is the majority case so it'd be useful to change that in the kit. It can always be changed for specific contexts. |
Suggest we start by changing the link in breadcrumb on the Question page template to 'JavaScript history -1' |
This came up again on support, this is the response I gave: You can use To do this with Nunjucks you can set the
This approach is not appropriate for production scenarios, where you cannot rely on JavaScript being available at all times. |
There was a conversation on Slack and Joe encourgaed us to share, so my two pence... We're working a large prototype at the moment with a bunch of different designers, some of which use JS back links. It causes a bit of a problem in that links will be shared to page in the journey and you'll want to see what came before, but the back link doesn't work. Not a massive problem but adding URLs makes the teams lives a lot easier. One negative though is that we have to deal with pages, like CYA, that might have different routes to get to it, so we have to have some if statements to deal with that. |
We currently recommend people add URLs to back links by hand. I think in the large majority of cases, using JavaScript to go back will be fine, and means it Just Works, making prototyping easier and faster.
The text was updated successfully, but these errors were encountered: