Title with error prefix
If you have a page containing a form, you should add the “Error: ” prefix to the page title if there is a validation error on the page.
This means that screen readers will read it out as soon as possible.
To do this, you can use the title_with_error_prefix
helper.
If you are using a Rails form, you can set the error attribute by calling errors.any?
on the form object:
= title_with_error_prefix("Personal details", error: @personal_details_form.errors.any?)