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

Replace back link placeholder URLs with JavaScript #1103

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

domoscargin
Copy link
Contributor

@domoscargin domoscargin commented Sep 30, 2021

In most cases, the back button should simply go back to the referring page, so we can use window.history.

Closes #494

There is a small potential issue when hovering on the link, as browsers will display the href property in the status bar, which in this case is just some javascript (as shown in the image below).

Screenshot 2021-09-30 at 09 10 08

I'm not sure how much of an issue this is for prototyping.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 September 30, 2021 08:30 Inactive
@domoscargin domoscargin changed the title Replace back link dummy URLs with javascript Replace back link placeholder URLs with javascript Sep 30, 2021
@joelanman
Copy link
Contributor

looks good! I don't think the hover thing is an issue. Needs an entry in Changelog I think

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 September 30, 2021 10:08 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 October 1, 2021 08:31 Inactive
@vanitabarrett
Copy link
Contributor

Not 100% sure, but you could argue this is a 'new feature' rather than a fix and therefore needs a more extended changelog entry to explain the change to users

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 October 1, 2021 08:48 Inactive
In most cases, the back button should simply go back to the referring page, so we can use `window.history`.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 October 1, 2021 08:50 Inactive
@domoscargin
Copy link
Contributor Author

I've added a feature CHANGELOG entry.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 October 1, 2021 11:23 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-1103 October 1, 2021 11:24 Inactive

## New features

### Replace back link placeholder URLs with javascript
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### Replace back link placeholder URLs with javascript
### Replace back link placeholder URLs with JavaScript


### Replace back link placeholder URLs with javascript

Previously, users had to manually replace the `href` for each back link in the page templates.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Previously, users had to manually replace the `href` for each back link in the page templates.
You can now use JavaScript to make the [back link component]( https://design-system.service.gov.uk/components/back-link/) take users to the previous page by default.


Previously, users had to manually replace the `href` for each back link in the page templates.

Now, we use JavaScript to make the back link take you to the previous page by default.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Now, we use JavaScript to make the back link take you to the previous page by default.
Before, you had to manually replace the `href` attribute for each back link in the page templates.


Now, we use JavaScript to make the back link take you to the previous page by default.

This approach is not appropriate for production scenarios, where you cannot rely on JavaScript being available at all times.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This approach is not appropriate for production scenarios, where you cannot rely on JavaScript being available at all times.
Do not use this approach for production scenarios, where you cannot rely on JavaScript always being available.


This approach is not appropriate for production scenarios, where you cannot rely on JavaScript being available at all times.

You can still override the `href` attribute if you need different behaviour.
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth giving an example of different behaviour? Or would that be overkill?

@vanitabarrett
Copy link
Contributor

After a chat with @EoinShaughnessy, we've decided it'll be easier for the 2i reviewer if all changelog/release note changes are in one PR. So we're going to merge this as-is and incorporate the suggested release note changes into a separate PR with the other changelog changes.

@vanitabarrett vanitabarrett merged commit bfccaa3 into main Oct 4, 2021
@vanitabarrett vanitabarrett deleted the bk-javascript-for-backlinks branch October 4, 2021 08:38
@EoinShaughnessy EoinShaughnessy changed the title Replace back link placeholder URLs with javascript Replace back link placeholder URLs with JavaScript Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use JavaScript for back links
5 participants