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

Remove appending hash behaviour when error summary link clicked #1435

Merged
merged 3 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@

🔧 Fixes:

- Stop appending hash when error summary link clicked

This prevents incorrectly focusing the form element with the hash id, instead of the error summary, when form is re-submitted with the hash in the URL and there are further errors.

([PR #1435](https://github.com/alphagov/govuk-frontend/pull/1435))

- Fix settings layer being implicitly dependant on itself.

([PR #1381](https://github.com/alphagov/govuk-frontend/pull/1381))
Expand Down
10 changes: 0 additions & 10 deletions src/components/error-summary/error-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ ErrorSummary.prototype.focusTarget = function ($target) {
return false
}

// Prefer using the history API where possible, as updating
// window.location.hash causes the viewport to jump to the input briefly
// before then scrolling to the label/legend in IE10, IE11 and Edge (as tested
// in Edge 17).
if (window.history.pushState) {
window.history.pushState(null, null, '#' + inputId)
} else {
window.location.hash = inputId
}

// Scroll the legend or label into view *before* calling focus on the input to
// avoid extra scrolling in browsers that don't support `preventScroll` (which
// at time of writing is most of them...)
Expand Down