Problem/Motivation
An error on a form lists the Vale alert but not the field it came from. Only the field highlight shows that. When two fields contain the same text, Drupal drops the repeated message, so the form lists fewer alerts than Vale found.
Steps to reproduce
- Opt two text fields on a content type in to Vale.
- Enter the same sentence with an error-level alert in both, and save.
- The error message shows the alert once, without either field's name.
Proposed resolution
Start each error line with the field's label, such as "Body: Vale.Repetition: ...". The lines then differ per field, and none is dropped. The message for text Vale could not check, when fail_closed refuses the save, gets the label too. JSON:API's 422 detail gains it after the property path: body.0.value: Body: Vale.Repetition: ....
Remaining tasks
- Review and merge.
Issue fork vale-3632984
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
shank115 commentedOpened an MR that adds the field label to the start of each Vale error line.
testErrorNamesField, which gives two fields the same text and checks that they produce two different messages.Publish-only mode is unchanged, since
ValeTreeConstraintalready starts each line with the field label.Comment #6
decipheredMerged into 1.0.x for 1.0.0. Thanks shank115
Each error now starts with the field's label, such as
Body: Vale.Repetition: ..., and JSON:API's 422 detail readsbody.0.value: Body: ....