diff --git a/packages/components/error-summary/error-summary.js b/packages/components/error-summary/error-summary.js index 024bbd9e7..50100597e 100644 --- a/packages/components/error-summary/error-summary.js +++ b/packages/components/error-summary/error-summary.js @@ -104,13 +104,16 @@ function handleClick(event) { } } -export default () => { +export default ({ focusOnPageLoad = true } = {}) => { // Error summary component const errorSummary = document.querySelector('.nhsuk-error-summary'); if (errorSummary) { // Focus error summary component if it exists - errorSummary.focus(); + + if (focusOnPageLoad) { + errorSummary.focus(); + } errorSummary.addEventListener('click', handleClick); } };