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

  1. Opt two text fields on a content type in to Vale.
  2. Enter the same sentence with an error-level alert in both, and save.
  3. 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

Command icon 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

deciphered created an issue. See original summary.

shank115 made their first commit to this issue’s fork.

shank115’s picture

Status: Active » Needs review

Opened an MR that adds the field label to the start of each Vale error line.

  • The message for text Vale could not check (when fail_closed refuses the save) gets the label too.
  • Updated the existing test expectations, and added testErrorNamesField, which gives two fields the same text and checks that they produce two different messages.

Publish-only mode is unchanged, since ValeTreeConstraint already starts each line with the field label.

deciphered’s picture

Status: Needs review » Fixed

Merged 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 reads body.0.value: Body: ....

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • deciphered committed 7412a959 on feature/3632983-lint-empty-scope authored by shank115
    feat(#3632984): name the field in each prose error