Prepend error to document.title when form submission fails

Created on 31 January 2022, almost 3 years ago
Updated 26 May 2023, over 1 year ago

Problem/Motivation

From comment #15 in #3258030: Text fields using CKEditor 5 do not get visual error indicator β†’

"the document title remains the same after the form submission failed due to a missing required field filled out properly or at all.
it might be helpful for especially screenreader users to update the document title that it shows something like (1 error) Create Article | Drupal 9 instead. that way a screenreader user has a direct feedback on page load knowing that something went wrong on form submission. another use case is for sighted users who have many tabs open. if one users gets distracted and pulled away from the computer for a while and when revisiting the browser with the updated document title it would be easily distinguishable and scanable which was the tab in question with an error.

*the suggestion about the pattern for prepending (x error(s)) to the document.title is from the form design patterns book by adam silver"

Steps to reproduce

1. Make sure that body field on basic page (or whatever content) /admin/structure/types/manage/page/fields/node.page.body
is set as required.
2. Edit content and fill in everything except the body field so the error will appear
3. Hit Save

Proposed resolution

Update document.title to prepend error like
(1 error) Create Article | Drupal 9

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
FormΒ  β†’

Last updated 11 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States hooroomoo

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024