Error Summary

A named, focusable overview of validation errors, with links to the fields that need correction. Show matching inline feedback as well as the overview.

Usage

<qds-error-summary id="errors" label="Check this operating update"></qds-error-summary>
<label for="report-name">Report name</label><input id="report-name" required>
<script type="module">
  import '/assets/components/error-summary/qds-error-summary.js';
  errors.items = [{id: 'report-name', message: 'Enter a report name.'}];
  errors.focus();
</script>

API and behavior

Accessibility and integration

The overview is a named alert with a heading, list of native links and programmatic focus target. Links support Tab/Enter; 44px hit targets, visible focus and primary text on themed surfaces retain light/dark readability. When the overview owns focus, call each field’s checkValidity() to update inline constraints without moving native focus, then populate the errors and focus the summary after rendering. Use reportValidity() when the individual field should receive focus. Let users choose a summary link to correct a field.

Guidance: GOV.UK error summary, W3C form notifications.

Quangular business use

Operations > New update (/#/operations/updates/new) uses generated items/events/focus methods to summarize invalid reporting fields. A link focuses the relevant numeric/text/checkbox-group field through its generated public API; existing select/date/checkbox reportValidity methods handle their invalid focus targets. The workflow remains local, with no persistent writes. The adjacent test.html demonstrates required and multi-error states, successful correction, default native focus, controlled hidden-panel focus and empty-state behavior.