HTML element to use for error summary
Optionalconfig: ErrorSummaryConfig = {}Error summary config
Protected_Static ConstantdefaultsError summary default config
StaticelementStaticmoduleName for the component used when initialising using data-module attributes.
Static ConstantschemaError summary config schema
Protected$rootProtectedReturns the root element of the component
ProtectedconfigProtectedReturns the root element of the component
Internal VirtualconfigOverride
Function which defines configuration overrides to prioritize properties from the root element's dataset.
It should take a subset of configuration as input and return a new configuration object with properties that should be overridden based on the root element's dataset. A Symbol is used for indexing to prevent conflicts.
Optionalparam: Partial<ErrorSummaryConfig>Configuration object
return - Configuration object
PrivatefocusPrivateFocus the target element
By default, the browser will scroll the target into view. Because our labels or legends appear above the input, this means the user will be presented with an input without any context, as the label or legend will be off the top of the screen.
Manually handling the click event, scrolling the question into view and then focussing the element solves this.
This also results in the label and/or legend being announced correctly in NVDA (as tested in 2018.3.2) - without this only the field type is announced (e.g. "Edit, has autocomplete").
Event target
True if the target was able to be focussed
PrivategetPrivateGet associated legend or label
Returns the first element that exists from this list:
<legend> associated with the closest <fieldset> ancestor, as long
as the top of it is no more than half a viewport height away from the
bottom of the input<label> that is associated with the input using for="inputId"<label>The input
Associated legend or label, or null if no associated legend or label can be found
PrivatehandlePrivateClick event handler
Click event
Staticcheck
Error summary component
Takes focus on initialisation for accessible announcement, unless disabled in configuration.