If an error is set on an element with #tree is TRUE. A duplicate child error is recorded in the #children_errors property of all parent elements for each child element.
In other words, if a single error is set on, for example, a compound field. All parent elements / wrappers of this compound field think there are multiple children errors. The more fields a compound field exists of the more duplicate children errors are recorded.
This has been identified in #2848507-74: Indicate that grouping elements have child element errors for ux and a11y and causes a bug for screen readers.
The nature of the problem is two-fold:
1) Errors bubble up when #tree is TRUE - In: getError() (Drupal\Core\Form\FormState).
2) When collecting children errors bubbled up errors are not ignored. - In: setElementErrorsFromFormState() (Drupal\Core\Form\FormErrorHandler).
Proposed solution:
Don't register bubbled up errors as child error, only use the original.
Comments
Comment #2
dmsmidtComment #3
andrewmacpherson commentedUpdating issue title, hopefully make more sense when I link to to it from the IFE roadmap follow-ups section.
Comment #4
dmsmidt@andrew, well what you describe is just one example. Not only is the count off, also the error messages themselves are internally set multiple times. And also non-compound form structures can exhibit this problem if they do complex stuff with nesting and setting errors on parents.
Anyhow, that's is shown in the IS.
Comment #17
smustgrave commentedThank you for reporting this problem. We rely on issue reports like this one to resolve bugs and improve Drupal core.
Since there has been no activity here for over 8 years we are asking if this problem persists on a currently supported version of Drupal. To help, add a comment explaining if the problem still occurs or not. Any extra detail you can provide can help others who experienced this.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!